exit with zero or one numeric argument like exit or exit 42 print "exit" and exit the shell.
exit with an invalid argument like exit hello prints an error message, prints "exit" and exits the shell with return value 255.
exit in a pipe, for example exit | cat | exit does not print "exit" and the return value of this command depends on which version of bash we're using. This does not exit the shell.
exit with multiple arguments, like, exit 1 2 3 prints an error message, prints "exit" but does not exit the shell.
This means that sometimes bash will print "exit" without actually exiting, which can be very confusing. Is this a bug or does this make sense for some reason?
\exitbut I guess that didn't work.command exitreproducesexit hello worldandexit foo 1will error but still exit so it seems only if the first argument is a valid number will it run into this.