LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-30-2005, 09:17 AM   #1
mathias1979
LQ Newbie
 
Registered: May 2005
Location: Raleigh, NC
Posts: 7

Rep: Reputation: 0
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
 
Old 05-30-2005, 10:16 AM   #2
Fredstar
Member
 
Registered: Jul 2004
Location: Rochester, NY
Distribution: Fedora9::FreeBSD7.1
Posts: 296

Rep: Reputation: 30
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Execvp With Quotation Marks amitbern Programming 10 11-25-2005 10:28 AM
no quotation marks jdoe9898 Linux - Newbie 1 10-12-2005 03:07 AM
trouble with quotation marks in c-shell script mathias1979 Programming 3 06-01-2005 08:49 AM
Quotation Marks Linux / Firefox jjdoll42 Linux - Software 6 04-19-2005 10:13 AM
Quotation marks and strings - in C lazyuser Programming 5 01-25-2005 08:14 AM


All times are GMT -5. The time now is 05:51 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration