I am learning shell scripting for my introductory UNIX course at my university, and I`m curious if is it possible to have more than one shell script in one text file. What I mean by that is, for example in pascal when you have:varbeginend.//another program which will be ignorecompiler ignores anything after the end with period. Can something like this be done with Shell? I`m asking because I have to go through lot of Shell examples and having many files opened is not very handy, with this I could run the same script without worrying about u+x permissions and just run the script with same name anytime I go to the next code example.So it is possible to have something that will say: end, do not read any further. ?Thank you in anvance for answering this silly question.
More shell scripts than one in one text file?
shell;shell script;scripting;text
For said purpose - that is stopping the script at any given line - you could simply use exit to break at this point. For any real life application this would seem a little crude though but for learning purposes it should fit.Say:#!/bin/sh# now I am working heredo_somethingexit# this is old, do not executedid_somethingexit# this is even older, do not executedid_something_long_ago