If you were to store a list of commands in a file for one-time use, you could execute it by typing:
But there's a better way to tell the shell to execute the contents of a file, and that is to make the file executable with thecommand:
Then, all you have to do to execute the script is type its name. (To make it even easier to use, you should
Of course, in either case, all of the lines in the file need to be meaningful to the shell! If you accidentally made a letter to your mother executable, and tried to run it as a shell script, you'd get error messages like this, containing the first word of each line in the letter:
letter: Dear: not found
The shell would try to interpret that word as a command, and report back that it doesn't know any command by that name.
Also, to really make good use of shell scripts, you need to understandand .