tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* Setting a variable which includes curly brackets
@ 1999-07-26 20:03 Ernie Bisson, MIT Bates Linear Accelerator
  0 siblings, 0 replies; only message in thread
From: Ernie Bisson, MIT Bates Linear Accelerator @ 1999-07-26 20:03 UTC (permalink / raw)
  To: tru64-unix-managers


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@mit.edu
--------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-07-26 20:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-07-26 20:03 Setting a variable which includes curly brackets Ernie Bisson, MIT Bates Linear Accelerator

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox