Hi below is my code for bash shell script, in this I want to capture error message for if clause, when it says either job is already running or unable to start the job to a variable, how it is possible in below script, or any other way for the below functionality
if initctl start $i  ; then
    echo "service $i  started by script"
else
    echo "not able to start service $i"
fi
 
     
     
     
    