Sunday, May 5, 2024
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 6264  / 3 Years ago, sun, may 30, 2021, 10:10:38

I want to declare variable with pwd() function, which will give me the current path. I want to use pwd() function as ${pwd} variable, something like that. How I must write? Thanks!


More From » command-line

 Answers
6

Use command substitution:



$ myvar=$(pwd)
$ echo $myvar
/etc
$ echo $(pwd)
/etc

[#30825] Monday, May 31, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
antebrow

Total Points: 291
Total Questions: 135
Total Answers: 117

Location: New Caledonia
Member since Thu, Mar 23, 2023
1 Year ago
antebrow questions
;