![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ! operator in variable | mmunir | Shell Programming and Scripting | 1 | 05-30-2008 12:29 AM |
| Help need: new line operator : | satyam_sat | Shell Programming and Scripting | 3 | 04-07-2008 06:31 AM |
| Or operator with if | babom | HP-UX | 1 | 10-03-2007 12:56 PM |
| ternary operator | naan | High Level Programming | 1 | 04-12-2007 12:58 AM |
| Operator question | TheCrunge | UNIX for Dummies Questions & Answers | 5 | 03-01-2005 12:27 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
And operator
I am trying to check two variables and if both are blank I want to set a flag:
Code:
the_f3_pid=`rsh $target ps -ef | grep "f3.eab" | awk '{print $2}'`
the_f7_pid=`rsh $target ps -ef | grep "f7.eab" | awk '{print $2}'`
if [ "$the_f3_pid" = "" && "$the_f7_pid = "" ] ; then
y=1
fi
./script_name[18]: test: 0403-021 ] character is missing. the_f3_pid and the_f7_pid are both blank since the software is not running on the machine I am checking. Any ideas ? Thanks, RC |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Is appears if I use and instead of && that it works ok.
|
|
#3
|
||||
|
||||
|
Change
"$the_f7_pid to "$the_f7_pid" Also change && to -a |
|
#4
|
||||
|
||||
|
change '&&' to '-a'
|
|
#5
|
||||
|
||||
|
You can also do the work without using the and operator :
Code:
if [ "$the_f3_pid$the_f7_pid" = "" ] ; then y=1 fi |
||||
| Google The UNIX and Linux Forums |