I am using this code to exit my program:
exit(){
clear
exit 0
}
This clears the screen, but does not exit the script and just leaves a blinking caret in the terminal. Is it possible that this does not work within a function?
I tried this method to exit:
trap "exit 1" TERM
export TOP_PID=$$
exit()
{
clear
kill -s TERM $TOP_PID
}
But this produces a similar result as the first idea.
Avoid using names of built-in commands as function names. You can get a list of the built-in commands using
help.To answer your question:
Replace
exit 0withcommand exit 0to force usage of built-in command.