Execute bash script and get the pid of that script process

#!/bin/bash

curpid=$$;

echo "curpid=${curpid}"

Another script to check if a current process pid is still running

The script name is test.bash

#!/bin/bash

curpid=$$;

echo "curpid=${curpid}";

if ps -p $curpid | grep $curpid | grep "test.bash" >> /dev/null; then
        echo "Your script is running";
else
        echo "Not running";
fi

Page Comments (Click to edit)






[Click to add or edit comments])

Please prepend comments below including a date

Design by N.Design Studio, adapted by solidGone.org (version 1.0.0)
Have a nice day.