tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: "Ernie Bisson, MIT Bates Linear Accelerator" <BISSON () BATES ! MIT ! EDU>
To: tru64-unix-managers
Subject: Setting a variable which includes curly brackets
Date: Mon, 26 Jul 1999 20:03:31 +0000	[thread overview]
Message-ID: <96079058316070.tru64-unix-managers.marc@archive.invalid> (raw)


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
--------------------------------------------------------------------------------

                 reply	other threads:[~1999-07-26 20:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

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