I have to create a bash script that check if there are other same scripts in execution. To do that I have implemented this solution
scriptToVerify="sl_dynamic_procedure.sh_${1}";
LOCKFILE=${SL_ROOT_FOLDER}/work/$scriptToVerify
if [ -e ${LOCKFILE} ] && kill -0 `cat ${LOCKFILE}`; then
  sl_log "---------------------------Warning---------------------------"
  sl_log "$scriptToVerify already in execution"
  exit
fi
trap "rm -f ${LOCKFILE}; exit" INT TERM EXIT
echo $$ > ${LOCKFILE}
I have addedd ${1} because my script has got a parameter. 
If I try to execute a script without a parameter (without ${1}) it works correctly. If I try to execute more than once the script with the parameter sometimes works and sometimes not. How can I fix my code?
