I've got a debug function in my script (that runs via nemo.action) that uses zenith popup to ask if the user want to stop or continue when an error occurs.
However, when this happens inside a loop, the exit command in the script or is completely ignored.
Isn't there anyway to force the exit to stop the script completely? I want it dead as a dodo! It must be able to kill it self..
this is part of my debug:
44:57.198 • Stopped while renaming file/directory - it failed
44:57.199 • Error triggered, issue:
44:57.201 • Stopped while renaming file/directory.\nSee debug log for more info...
45:20.563 • Stopping the script by user request due error. ()
^^^ this line gets written to the log when the user choose to exit
vvv but it continues to run the script until a new error occurs
45:20.564 • Could not find ‘/temp/sani.txt‘ Have no value to assign to $jdir0
45:20.566 • Error triggered, issue:
45:20.567 • Could not find ‘/temp/sani.txt‘ Have no value to assign to $jdir0
45:24.670 • Stopping the script by user request due error. ()
^^^ and when pressing stop here, the script will halt..
It's the same error function that's getting triggered:
jerror () {
enl
jdbugen "Error triggered, issue:\n\n"
jdbug "$@"
debuglogread=$(tail -10 "$debuglog")
zenity --question --text="($jdec)Error Triggered\nIssue:\n\n ‘$@‘\n\n$debuglogread\n\nContinue?" --width=400 --height=200
jdec=$?
if [ "$jdec" != 0 ]
then
jdbug "Stopping the script by user request due error. ($jdeck)"
exit 1
else
jdbug "User choose to continue the script"
fi
enl
}
this part of the script is calling the function:
mv -f -v "$item" "$path/$name" &>> $debuglog # Rename
jok=$?
if [ $jok -ne 0 ]
then
jdbug "Stopped while renaming file/directory - it failed"
jerror "Stopped while renaming file/directory.\nSee debug log for more info..."
fi
while IFS= read -d '' -r item do... the script itself is on 522 lines.