SunQuest
           UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old August 6th, 2003, 01:53 AM
zedmelon's Avatar
zedmelon zedmelon is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: under a rock
Posts: 54 zedmelon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 20 m 42 sec
Reputation Power: 5
executing variables in ksh script?

In a ksh script on an AIX box running a jillion oracle database processes, I'm setting a variable to one of two possible arguments, depending on cmd line arguments.

FINDIT="ps -ef | grep oracle | grep DBexport | grep rshrc"
-or-
FINDIT="ps -ef | grep oracle | grep prod | grep runback"

I want to have a way to execute the command list defined by the variable $FINDIT later in the script, putting the result in another variable. Any ideas how?

Things I have tried:
1. The straightforward RESULT=`$FINDIT`
(I get a usage on ps)

2. Putting the list in braces gives me bad substitution
FINDIT=${list}

3. exec is not on the system.

With either of the possible values of $FINDIT, if I execute them on the command line, there is no problem. What am I doing wrong?

Thanks,
-zedmelon
__________________
Mother says my .sig can beat up your .sig.

Reply With Quote
  #2  
Old August 6th, 2003, 03:01 AM
zedmelon's Avatar
zedmelon zedmelon is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: under a rock
Posts: 54 zedmelon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 20 m 42 sec
Reputation Power: 5
depressing update...

I thought I'd found the answer in a post by M.Hirsch on this page here:
http://forums.devshed.com/t74294/s.html

RESULT=`echo -e "$FINDIT"`
only puts this into the variable $RESULT:
"-e $FINDIT"

:(

slash me grows despondent...

Reply With Quote
  #3  
Old August 6th, 2003, 12:28 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 39 m 55 sec
Reputation Power: 184
RESULT=`eval $FINDIT`

Comments on this post
zedmelon disagrees!
__________________
--
Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more.

Reply With Quote
  #4  
Old August 6th, 2003, 01:01 PM
zedmelon's Avatar
zedmelon zedmelon is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: under a rock
Posts: 54 zedmelon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 20 m 42 sec
Reputation Power: 5
THANKS!

M.Hirsch...

That worked on the command line. I'm betting it'll work in the script as well. Of course, this is monitoring a process that runs 1/week, so I'll confirm next Tuesday...
:(

Thanks again; I appreciate the help.

-zedmelon

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > executing variables in ksh script?


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

IBM developerWorks




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway