![]() |
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 |
| 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 |
| shell script error | alias_juju | UNIX for Dummies Questions & Answers | 2 | 07-02-2008 01:05 PM |
| Shell Script Error | jazz8146 | UNIX for Dummies Questions & Answers | 0 | 04-23-2008 07:38 AM |
| Shell script run error ksh: not found | nz80qy | Shell Programming and Scripting | 3 | 03-25-2008 10:57 AM |
| awk Shell Script error : "Syntax Error : `Split' unexpected | Herry | UNIX for Dummies Questions & Answers | 2 | 03-17-2008 11:16 AM |
| error in shell script | jalpan.pota | UNIX for Dummies Questions & Answers | 2 | 05-18-2007 09:14 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
SHELL SCRIPT error
Hi I am a new member,can any one help me
#!/bin/sh # 'clear' for i in $(seq -w 15 37) do #echo $i string1= wget --dns-timeout=0.001 http://napdweb${i}.eao.abn-iad.ea.co.../test/test.jsp; if [ "$string1" = "$Resolving napdweb${i}.eao.abn-iad.ea.com...failed connection timed out." ]; then echo "May be napdweb${i}.eao.abn-iad.ea.com...has hung, please restart." else echo "Everything is good and fine" fi done ~ After the wget command is executed,i assigned that string to another string called string1. so in the next step when that string1 is equal to a particular string as i given in program, it should display a msg as server is down please restart otherwise else part should be displayed.I dont know why my logic is not running can any one solve it plssssssss |
|
||||
|
Hi! your variable is set incorrectly and your logic is a bit wrong. Try changing your script into this:
Code:
wget --dns-timeout=0.001 http://napdweb${i}.eao.abn-iad.ea.com:8000/webcore/test/test.jsp -o testme.log
string1=`grep failed testme.log`
**your test here**
Hope that helps. |
|
||||
|
Hi,
to assign the output of wget to string1 You should use this insted: Code:
string1=$(wget --dns-timeout=0.001 http://napdweb${i}.eao.abn-iad.ea.co.../test/test.jsp)
/Lakris /Lakris |
|
||||
|
Quote:
Code:
yongitz@wolfgang:~$ string1=$(wget --dns-timeout=0.001 http://napdweb${i}.eao.abn-iad.ea.com:8000/webcore/test/test.jsp)
--14:18:38-- http://napdweb.eao.abn-iad.ea.com:8000/webcore/test/test.jsp)
=> `test.jsp'
Resolving napdweb.eao.abn-iad.ea.com... failed: Connection timed out.
yongitz@wolfgang:~$ echo $string1
yongitz@wolfgang:~$
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|