dynamic environment variables

Questions and discussion about scripting issues - sh, ksh, csh, perl, etc.

dynamic environment variables

Postby joryte » Wed Apr 19, 2006 11:10 pm

Hello,

I'm trying to establish a dynamic environment variable (in my Cygwin .bashrc) from the $PWD, something like :

alias TEST="export Variable='$(cygpath -w $PWD)\DIRECTORY'"

When I call TEST, the PWD it uses is the PWD from when the .bashrc was last sourced (so if I've changed directories, it doesn't give me the current $PWD [verified by changing directories, then "$ env", then "$ TEST", then "$ env"]).

I've found I can get it to spit out the right $PWD if I add source ~/.bashrc to the beginning of the alias, in front of the variable export, but then I lose information from other aliases I've performed (like exporting other environment variables).

Does anyone know the reason for this and how I can create this variable from the pwd?

joryte
joryte
 
Posts: 1
Joined: Tue Apr 18, 2006 11:49 pm

Advertisement

Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron