|
|
#121 |
|
MVP
Join Date: Apr 2002
Location: Korat, Thailand
Posts: 2,046
|
The problem I'm having now is that tcsh doesn't have an "export" command. I'm having trouble figuring out how to make the PATH_SET variable global.
But, at least the script is working if I set the variable from the command line....
__________________
http://www.mgnewman.com/ |
|
|
|
|
|
#122 |
|
Major Leaguer
Join Date: Jan 2002
Location: Adelaide, South Australia
Posts: 470
|
"setenv" is what you're searching for:
setenv EDITOR /usr/local/bin/vim for example. Cheers, Paul |
|
|
|
|
|
#123 | |||||||||||||||||||
|
MVP
Join Date: Apr 2002
Location: Korat, Thailand
Posts: 2,046
|
Thank you. I was using this, but it kept failing because of a logic error. (I guess I didn't play "Zoombini's" enough!) Anyway, here's the code that seems to work. I threw in the test for xterm because I was still getting redundant x11r6 paths in xterm. But, they mysteriously went away.... I left the code there for future use. If I'd known it was going to take so long to write less than a dozen lines of code, I might not have bothered. At least it kept me busy while the tropical storm messed up my long weekend: Code:
#.setpath # this file can be sourced by anyhbody who needs to set the path if ( ! $?PATH_SET ) then setenv PATH_SET true if ( "$TERM" == "xterm" ) then echo ' setting path for xterm' setenv PATH :~/bin:/usr/local/bin:/usr/bin:/bin: /usr/local/sbin:/usr/sbin:sbin:/Developer/Tools :/usr/x11R6/bin else echo 'setting path for some other term' setenv PATH :~/bin:/usr/local/bin:/usr/bin:/bin: /usr/local/sbin:/usr/sbin:sbin:/Developer/Tools :/usr/x11R6/bin endif else echo 'path already set' endif
__________________
http://www.mgnewman.com/ |
|||||||||||||||||||
|
|
|
|
|
#124 |
|
Major Leaguer
Join Date: Jan 2002
Location: Adelaide, South Australia
Posts: 470
|
A couple of quick things: firstly, you should kill that leading colon, which will prevent the ~ from being expanded into your home directory. (That is, I don't think it's working as expected at the moment: try "which exe", where "exe" is in your ~/bin directory: it won't be found.
Secondly, and maybe it's a point of style moreso than one of substance, but if you're going to repeat a long and somewhat ugly string of directories letter for letter then set up a variable to hold it once and once only: MYPATH=~/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin and so on, and use it in your calls to "setenv" setenv PATH $MYPATH (That way you can change it in a single place rah rah...) Cheers, Paul |
|
|
|
|
|
#125 |
|
MVP
Join Date: Apr 2002
Location: Korat, Thailand
Posts: 2,046
|
Paul,
Thanks for your thoughts. I'll get rid of the leading colon. I think it snuk in there during a copy/paste. Although the long path is repeated in the version of the code I posted, I originally thought that I would have to have separate paths set for xterm and non-xterm sessions. Now I think this is not the case, so I'll probably remove the terminal test. That said, your point about style is right on. Even if only used once, this long and ugly string ought to be set in a variable to make the logic of the code easier to follow. Thanks again.
__________________
http://www.mgnewman.com/ |
|
|
|
![]() |
|
|