I am trying to run the same awk command from the script but I get an extra false I am not sure were it is coming from However when i run the command from terminal it does not return false ?
get_state.sh
#/bin/bash
# sed -n '/\\State/{getline; print}' /var/opt/BESClient/besclient.config
export SERVER_STATE=`awk '/\\State/{getline; print $3}' /var/opt/BESClient/besclient.config`
echo $SERVER_STATE
echo $SERVER_STATE
exit 0
Output
./get_state.sh
false Live
false Live
but
sh-4.1$ awk '/\\State/{getline; print $3}' /var/opt/BESClient/besclient.config
Output
Live