* .cshrc syntax help
@ 2004-01-30 12:24 Karen R McArthur
2004-01-30 16:16 ` SUMMARY: " Karen R McArthur
0 siblings, 1 reply; 2+ messages in thread
From: Karen R McArthur @ 2004-01-30 12:24 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 563 bytes --]
I'd like to add an if statement to our .cshrc or .login file, but I'm
having problems with the syntax. Could someone help?
If the "dot" entry does not exist in the $PATH variable, append it to
the $PATH variable. Sounds simple enough, huh? I've tried the
following and many permutations of it ... any help would be appreciated.
if ( ${PATH} !~ *\.* ) then
set PATH=($PATH .)
endif
--
Karen R. McArthur, Systems Administrator
Bates College, Information and Library Services
Lewiston, Maine 04240
(207) 786-8236 fax:(207) 786-6057
kmcarthu@bates.edu
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 3082 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread* SUMMARY: .cshrc syntax help
2004-01-30 12:24 .cshrc syntax help Karen R McArthur
@ 2004-01-30 16:16 ` Karen R McArthur
0 siblings, 0 replies; 2+ messages in thread
From: Karen R McArthur @ 2004-01-30 16:16 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 1210 bytes --]
Kudos to Paul Sand, Stephen Feehan, Tim Cutts, Bob Harris and Dr Blinn.
All of them sent me working solutions to this problem! Thank you very
much. I used Dr Blinn's solution with 1 change: I added -e'^\.:' to the
grep.
Here's Dr Blinn's reply:
I would try something like
echo $PATH | grep -q -e ':\.:' -e ':\.$' && echo there
or in your script,
echo $PATH | grep -q -e ':\.:' -e ':\.$' || set path="$path ."
Note that in the C shell there is a BIG difference between the
standard environment variable PATH and the C shell specific
variable "path". If you want to manipulate PATH directly,
you'd need something like this:
echo $PATH | grep -q -e ':\.:' -e ':\.$' || setenv PATH "$PATH:."
Try echo $PATH and echo $path and notice the differmints..
Tom
Karen R McArthur wrote:
> I'd like to add an if statement to our .cshrc or .login file, but I'm
> having problems with the syntax. Could someone help?
>
> If the "dot" entry does not exist in the $PATH variable, append it to
> the $PATH variable. Sounds simple enough, huh? I've tried the
> following and many permutations of it ... any help would be appreciated.
>
> if ( ${PATH} !~ *\.* ) then
> set PATH=($PATH .)
> endif
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 3082 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-01-30 16:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-30 12:24 .cshrc syntax help Karen R McArthur
2004-01-30 16:16 ` SUMMARY: " Karen R McArthur
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox