Setting a Variable to your PWD
hey, guys, how's it going? Got a simple question with setting a variable in csh. I want to set a variable to the present working directory (pwd), but so far I've had no luck with
set variable = pwd Is there it can be done?
also it seems pwd/directoryname doesn't work with cd because I tried that as well.
Any help would be appreciated!
most variables are of the form $VARIABLE
dont know if this will work with $PWD
try?
bren
The convention is to use uppercase for environment variables and lowercase for shell variables, but nothing enforces that. I think csh sets the environment variable PWD to the current working directory, so you could use that, or to set your own shell variable you could use:
Code:
set mypwd=$PWD
If for some reason $PWD isn't being set, you could also run the pwd command and put it's result in a shell variable with:
Code:
set mypwd=`pwd`
Awesome, the first line worked! THANKS! |