Computing.Net > Forums > Unix > How to set a variable

How to set a variable

Reply to Message Icon

Original Message
Name: Preecha
Date: March 13, 2003 at 02:05:11 Pacific
Subject: How to set a variable
OS: Solaris
CPU/Ram: 512MB
Comment:

How can we put this value to a shell variable (in C Shell)?

{print "I'm OK"}

I've tried:
set mystr="{print \"I'm OK\"}"
set mystr='{print "I\'m OK"}'

Both failed.
I don't know how to escape the quotes.
Thanks!


Report Offensive Message For Removal

Response Number 1
Name: deeps
Date: March 13, 2003 at 09:25:56 Pacific
Subject: How to set a variable
Reply: (edit)

hi,

Well here my solution:

I have broken the string given by you in parts.

here it goes:

set str1='print "I'
set str2="'m OK"
set str3="
set mystr="{$str1$str2$str3}"

and you are all set with mystr.

Give set on the prompt and you shall see the
mystr variable set as {print "I'm OK"}


~deeps


Report Offensive Follow Up For Removal

Response Number 2
Name: deeps
Date: March 13, 2003 at 09:30:35 Pacific
Subject: How to set a variable
Reply: (edit)

Well there's a small correction

You have to do
set str3=\"

and not set str3="

~deeps


Report Offensive Follow Up For Removal

Response Number 3
Name: Preecha
Date: March 14, 2003 at 20:24:03 Pacific
Subject: How to set a variable
Reply: (edit)

Thanks, Deep.


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: How to set a variable

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software