Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google site




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 04-12-2009
sauron's Avatar
sauron sauron is offline
Registered User
 

Join Date: Apr 2009
Posts: 33
Hi
the error occours because when you write "server1 server2" $HNAME will be "server1 server2" and not "server1" "server2" so when you test you variable with the if statement, you are asking what follow:

if [ "server1 server2 " = server1 ]

and it will be always false.

Tony before told you to use "for" to read your HNAME

for SERVERS in $HNAME; do

here you can put you if statement because you are reading one input for iteration

done

hope it helps

Bye Bye

------------------------------------
Computers are like air-conditioners
they stop working properly
when you open windows