Linux Blog

How to End or Exit a Shell Script

Filed under: Shell Script Sundays — TheLinuxBlog.com at 9:32 pm on Sunday, January 20, 2008

This week I apologize for the late entry to this column and for the crappy title. But this blog is as much for me to learn as it is for others so this week I’m going to post something that I couldn’t remember how to do correctly. Ending a shell script. Yes, laugh all you want folks, I forgot how to get out of a shell script loop without pressing CTRL+C. I tried the following in the if statement:

 end
die
quit

The last one I tried was obviously the correct one which is exit. I’m hoping that this happens to every one and not just me. I seem to do it all the time, I just can’t remember the commands for certain things. There are a couple in PHP that I can never remember.