I would like to extract the current path in a variable and use it later on in the script
Something like:
myvar = pwd
Later on:
cd myvar
But my bash skills have rusted over the years.
How would i go on about doing that?
I would like to extract the current path in a variable and use it later on in the script
Something like:
myvar = pwd
Later on:
cd myvar
But my bash skills have rusted over the years.
How would i go on about doing that?
Something like this should work:
(Quotes are necessary if your path contains whitespaces.)
in bash
Ind addition to the
pwd
command and the$PWD
environment variable, I'd also suggest you look intopushd
/popd
:It worked for me: