w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Shell script while loop not exiting

There are some quoting issues in your script and the way you are starting the sub shell is invalid syntax.

Also you should make sure, that there is no trailing whitespace or other characters:

# quote the "true"
while [ "$status" != "true" ]
  # use $(...) to start a sub shell
  status=$(wget -q -O - http://server)
  # add >> << to make extra space visible. use quotes
  echo ">>$status<<"
  echo "Sleeping for 5 sec";
  sleep 5;

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.