> > I'm having difficulty with the following script:

I'm having difficulty with the problem.

> > SYNHOST=caalt04
> > 
> > if echo `ping -c 1 $SYNHOST` | grep -q "1 received"; then

Works fine:

sh -c 'if echo `ping -c 1 localhost` | grep -q "1 received" ; then echo Y;
else echo N; fi'
Y

The variable substitution is of no consequence.

> sh --version
GNU bash, version 3.1.17(1)-release (i586-suse-linux-gnu)

> Your syntax is wrong. 
> 
> if [ echo `ping -c 1 $SYNHOST` | grep -q "1 received" ]; then

Oops. You need another coffee ;)))

After if follows a command to execute. echo is fine, as is test and [.
If you do put [ or test, you are subject to the argument syntax of those
commands, and echo is not part of that.

Volker

-- 
Volker Kuhlmann                 is list0570 with the domain in header
http://volker.dnsalias.net/     Please do not CC list postings to me.

Reply via email to