Forums

automatically close bash console

Is it possible to automatically close bash console after running a script?

This is not a scheduled script. I run it manually when I need to.

The Bash 'exit' command is your friend.

"exit" in the last line of the script will stop the script but the console is still running, so I have to type exit in the bash console to actually close it. Was wondering if I can do that automatically from the script. Also, cron exit or &&exit do not close the bash console.

One way is to put the command(s) you want to run into a Bash shell file, and then use the 'exec' command to run the file, e.g.

exec ./try

where 'try' is a file containing the commands you want, and you've made the 'try' file executable.

HTH,

Jim

I will try that. Thanks!

you can also setup custom commands from the console tab- those close after they finish running unless told otherwise