LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   trouble with quotation marks in c-shell script (http://www.linuxquestions.org/questions/linux-newbie-8/trouble-with-quotation-marks-in-c-shell-script-328525/)

mathias1979 05-30-2005 09:17 AM

trouble with quotation marks in c-shell script
 
Hello,

I'm writing a c-shell script in which I need to obtain the ip address of the person running the script and return it to a variable. I'm using the following command to obtain the ip:

echo $SSH_CLIENT | awk '//{print $1}'

The problem: the only way I'm know to save terminal output as a variable is by doing something like:

set variable = 'command'

So if I put "$SSH_CLIENT | awk '//{print $1}'" in for the command, then there are two sets of single quotation marks, one nested inside the other.

set variable = '$SSH_CLIENT | awk '//{print $1}''

And instead of recognizing them as such, linux assumes the second single quotation closes the first and the command doesn't work.

So how can I write the command so that linux will recognize that second quotation mark as being nested inside the first, as opposed to closing the first so that my command will work properly?

Thanks,
Matt

Fredstar 05-30-2005 10:16 AM

mathias you will probably get a lot of hits if you post this type of questions in the programming area of the forum. Most questions here have to deal mainly with distros and people new to the linux operating system.


All times are GMT -5. The time now is 12:58 PM.