I have a script called csh.cshrc that contains the following line
setenv PATH "${PATH}:/usr/X11R6/bin:/usr/local/bin"
With a tcsh script, I want to change the value of PATH by extracting what is
between the double quotes and add to it using "sed".
The command,
grep 'setenv PATH' csh.cshrc | awk -F\" '{printf("%s\n",$2)}'
Produces the desired output,
${PATH}:/usr/X11R6/bin:/usr/local/bin
If I try to set a shell variable to contain the above string, then the curley
brackets get lost.
The commands,
set Path = `grep 'setenv PATH' csh.cshrc | awk -F\" '{printf("%s\n",$2)}'`
echo ${Path}
Produce the output,
$PATH:/usr/X11R6/bin:/usr/local/bin
Is there a way that I can preserve the brackets in a shell variable?
Thanks for any help,
Ernie
--------------------------------------------------------------------------------
Ernie Bisson
M.I.T. Bates Linear Accelerator
P.O. Box 846
Middleton, Massachusetts 01949-2846
(508) 774-2370 or (617) 253-9218
E-Mail : bisson_at_mit.edu
--------------------------------------------------------------------------------
Received on Mon Jul 26 1999 - 20:06:41 NZST