Read=$((ps -eaf | grep "$name" | grep -v grep | awk '{print $1}'))
Read1=$((ps -p <$Read>))
if [ $Read1 -ne 0 ]; then
exit 1
This is what I get so far, I want to first get the pid of the $name, then check whether there is process corresponding to that pid. If there is not, exit 1.
I am not sure about this.
pidofandpgrep