|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | 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 and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | 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
fiI get an error: ./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 |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Is appears if I use and instead of && that it works ok.
|
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
Change
"$the_f7_pid to "$the_f7_pid" Also change && to -a |
|
#4
|
||||
|
||||
|
change '&&' to '-a'
|
| Sponsored Links | |
|
|
#5
|
||||
|
||||
|
You can also do the work without using the and operator : Code:
if [ "$the_f3_pid$the_f7_pid" = "" ] ; then y=1 fi |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Awk with or and not operator | infernalhell | Shell Programming and Scripting | 1 | 06-12-2011 11:26 AM |
| sed or operator | shyamxtasy | Shell Programming and Scripting | 5 | 10-16-2010 08:55 PM |
| += operator | astrolux444 | UNIX for Dummies Questions & Answers | 3 | 09-06-2010 11:05 AM |
| su with << operator | arunkumar_mca | UNIX for Dummies Questions & Answers | 3 | 12-29-2009 10:29 PM |
| SED * operator | sinpeak | Shell Programming and Scripting | 7 | 12-24-2008 09:07 AM |
|
|