The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Basic Linux Shell Scripting for Oracle DBAs iBot Oracle Updates (RSS) 0 04-06-2008 05:10 AM
basic shell scripting question convenientstore Shell Programming and Scripting 3 05-27-2007 10:21 PM
Shell scripting basic doubt sendhilmani123 Shell Programming and Scripting 3 08-04-2006 06:07 AM
scripting guru's pls help me with scripting on AIX thatiprashant Shell Programming and Scripting 1 01-20-2006 07:58 PM
What is a good place to learn basic shell scripting? Thanks! deutchap6verse5 Shell Programming and Scripting 2 03-08-2005 02:55 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-24-2008
jon80 jon80 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 12
basic scripting help

I would like to know:
1. How is `command` used?
2. How is '$command' used?

For example, a script file that checks for apache tomcat processes that I created has the following lines:

test
set suffix=` grep "6.0.18"`
set command = `ps -ef $suffix`
echo $command //?? hoping this works...
#`command` //??

Errors when I run the file:
./test: line 4: unexpected EOF while looking for matching ``'
./test: line 5: syntax error: unexpected end of file

Can anyone help me find my mistakes?
  #2 (permalink)  
Old 08-24-2008
redoubtable redoubtable is offline
Registered User
  
 

Join Date: Aug 2008
Location: Portugal
Posts: 242
bash:
Code:
command=$(ps -ef | grep "6.0.18")
echo $command
  #3 (permalink)  
Old 08-24-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,305
If you want to evaluate a string as a command you can use eval:

Code:
suffix='grep "6.0.18"'
command='ps -ef | $suffix'

eval $command
Regards
Closed Thread

Bookmarks

Tags
eval, script, variables

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:34 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0