Hi all,when I cd to an environment variable "cd $MYDIR, if I type pwd, I don't the path to the environment variable dir I cd to. Appreciate the help, regards..Abbya
But what else, instead?
Your request amounts to something like when i add 1 to 1 i don't want the result to be 2.
When you set an environment variable "MYDIR" to some value, say, "/some/where" and you do a cd $MYDIR
you do - effectively - a cd /some/where
.
If you now issue the command pwd
, it will tell you the current directory you are in. In fact, this - to tell you the current directory you are in - is the very purpose of the command pwd
. And because you just changed to /some/where
before this current directory will invariably be /some/where
.
Just in case you meant the (enviroment variable) $PWD
(not "$pwd" - UNIX is case sensitive): this is a variable automatically maintained by many shells (ksh and bash among them) to always point to the same (current) directory, the command pwd
is displaying. For this, the same goes as i already said about the command. If you go to a certain location you are there - and because "location" is where you are, regardless of where this is, it will be your location and your location will be where you are.
And, by the way, i would appreciate if you could come up with more telling thread titles. Maybe i am extra slow, but i couldn't glean any meaning from "$pwd".
I hope this helps.
bakunin
This sounds simple to explain......
If you 'cd' to a variable (to define the directory) and after that command has executed a 'pwd' doesn't tell you that you're in that directory, then the 'cd' command didn't work.
There's something wrong with your variable definition and/or the 'cd' command construct.
If any of the some/where argument of the cd command goes to a symbolic link, then the real path from pwd command will differ.
@MadeInGermany........yes, good point. Also, like Bakunin, I wonder why this thread is entitled $pwd (what's the $ got to do with it?)
Thank you all for the feedback, apologize for the title name, I am new to Unix only practice it very seldom.