how can I get status from command, which is assigned into variable?
For example:
#! /bin/bash
### GET PID
GETPID=$(ps aux | grep "bash" | grep -v "grep" | awk '{print $2 }')
if [ "$?" = "0" ]; then
echo "status OK"
else
echo "status NOT OK"
fi
$$-->echo $$. Regarding the question itself, yourifcondition checks an integer, so that you want to sayif [ "$?" -eq 0 ]"... that is, use-eqto check equality in integers.$GETPIDand the exit status is in$?. What's the problem?