![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Bash: bad substitution problem...pls help! | xfouxs | UNIX for Dummies Questions & Answers | 1 | 11-23-2007 05:48 PM |
| Substitution problem. | er_ashu | Shell Programming and Scripting | 3 | 04-03-2007 07:48 AM |
| ksh substitution | solea | Shell Programming and Scripting | 2 | 08-09-2004 05:30 AM |
| bad substitution problem (easy question) | champion | UNIX for Dummies Questions & Answers | 10 | 07-01-2002 11:16 PM |
| Substitution using sed | Ohji | UNIX for Dummies Questions & Answers | 3 | 08-17-2001 11:32 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
VI Substitution problem
I'm having a problem getting my variables to work in dishing out an RMC script.
The $1 works fine. $2 does not Here's a portion of the script: server=$1 filesystem1=$2 # dsh -w $1 'mkcondition -c "/var space used" -s "Name == \"$2\"" -e "PercentTotUsed > 90" -d "An event will be generated when more than 90 percent" -E "PercentTotUsed < 85" -D "The event will be rearmed when the percent of the space used in the $2 directory falls below 85 percent." "$2 space 90% used"' # The cmd entered on the cmd line is ./mkcondition techserv /testfs1Here is the output server=$1 filesystem1=$2 + filesystem1=/testfs1 filesystem2=$3 + filesystem2= filesystem3=$4 + filesystem3= # echo $2 + echo /testfs1 /testfs1 # dsh -w $1 'mkcondition -c "/var space used" -s "Name == \"$2\"" -e "PercentTotUsed > 90" -d "An event will be generated when more than 90 percent" -E "PercentTotUsed < 85" -D "The event will be rearmed when the percent of the space used in the $2 directory falls below 85 percent." "$2 space 90% used"' + dsh -w techserv mkcondition -c "/var space used" -s "Name == \"$2\"" -e "PercentTotUsed > 90" -d "An event will be generated when more than 90 percent" -E "PercentTotUsed < 85" -D "The event will be rearmed when the percent of the space used in the $2 directory falls below 85 percent." "$2 space 90% used" # Any suggestions would be greatly appreciated. __._ |
|
||||
|
Thanks for replying.
The "Name == \"$2\"" is part of the mkcondition command structure in RMC. And the quotes and backslashes are what's failing my substitution...grrr.. I've tried hundred different ways but cant get it to substitute.. Mike M. |
|
||||
|
The "$2" will be resolved, because variables are expanded prior to the execution of a command (see "command evaluation in the Korn shell" - to change the default behaviour is what "eval" is for, yes?) .
The problem is that the "$2" is inside single quotes, which will prevent evaluation of the variable: Code:
# var="hello there" # print $var hello there # print "$var" hello there # print '$var' $var Code:
var="there" # print 'hello '"$var"'.' hello there. Quote:
I hope this helps. bakunin |
| Sponsored Links | ||
|
|