I'm trying to write a simple script that monitors if a program is already running and if it is it does not initiate another instance but if it is not then it runs.
Here is the code:
# If program is running $RUNNING_INSTANCE = 1
RUNNING_INSTANCE= ps -A | grep -c 'xbindkeys';
if [ "$RUNNING_INSTANCE" -eq 0 ]; then
echo "Running: $RUNNING_INSTANCE"
echo "Running: $RUNNING_INSTANCE";
Now ... this part works
s -A | grep -c 'xbindkeys' but RUNNING_INSTANCE does not take the value. It does not matter what I do I cannot assign the value to it.
Does anyone have an idea where I'm going wrong? I'm not a bash programmer but it occurs to me that that should work.