bash - need help modifying a script to check service status -
i have script gets called remotely check status of service , echo whatever tell to. external process calls script determines service gets checked. instead of echoing custom message need echo out actual output of command. here script now: #!/bin/bash s1="active" info=$(systemctl status $1 | awk 'nr==3' | awk '{print $2}') if [ $info == $s1 ] echo $1 "is running!" exit 0 else echo $1 "is not running!" exit 2 fi as can see, pretty basic , scripting not cup of tea works. need make more complex. in script instead of echoing out "$1 running" or "$1 not running" need change 2 echo result command giving me 3rd line only. need echo this: active: active (running) since fri 2015-10-30 14:58:47 cdt; 1h 7min ago which actual result of command in script excluding awk '{print $2}' and if result comes "active running" or "active exited", etc.. needs exit 0. if result comes ot...