![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | 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. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| what is wrong with this script? | rs1969 | UNIX for Dummies Questions & Answers | 2 | 11-15-2007 07:16 AM |
| What's wrong with this script | amitg1980 | Shell Programming and Scripting | 3 | 11-12-2007 07:00 PM |
| What is wrong with this script? | heprox | Shell Programming and Scripting | 8 | 11-16-2006 05:43 AM |
| what is wrong with this script? | circleW | Shell Programming and Scripting | 2 | 09-28-2004 09:27 PM |
| What is wrong with my script? | Lem2003 | UNIX for Dummies Questions & Answers | 6 | 05-29-2003 02:17 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
what is wrong with this script?
why??? I don't get it..
while read line do count=$(ping -c 3 $line | grep 'received' | awk -F ',' '{print $2}' | awk '{print $1}') if [ $count -eq 0 ] ; then echo "Host: $line is down" else echo "Host: $line is up" fi done<host.list sh -x ./hoststatus ./hoststatus: syntax error at line 5: `count=$' unexpected ~ |
|
||||
|
another way to write: Code:
for line in $(tr '\n' ' ' < "file")
do
count=$(ping -c 3 $line | grep 'received' | awk -F ',' '{print $2}' | awk '{print $1}')
if [ $count -eq 0 ] ; then
echo "Host: $line is down"
else
echo "Host: $line is up"
fi
done
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|