So this is just out of sheer curiosity.
I've written a small 'permissions check' function in one of my bash scripts.
Code:
function PermissionsCheck {
if [ "$(whoami)" != "root" ]; then
echo "You must re-run the script as root!"
exit
fi
}
So the logic works, but if it reaches exit, it closes the terminal. I simply want it to mimic a SIGINT signal and just stop the script and keep it at the prompt. I'm just not entirely sure of the command, exit is probably not the right idea.
Any thoughts?