Shell Scripts
Last updated
Last updated
MIT Resources
https://accessibility.mit.eduMassachusetts Institute of Technology
Shell scripts are sequential collection of commands that generally represent a workflow.
Shell scripts can use other commands as building blocks.
Suppose that occasionally you want the system to tell you some simple information, like your user id, the current directory and its content, and display the current date. To avoid typing this sequence of commands every time you want to know this information, you can compose a short script that execute the commands in a specific order.
Open a text editor (e.g. nano).
Type the sequence of commands to execute in the specific order they should be executed.
Save the file by giving to the script a meaningful name, for example info.sh.
Execute the command by invoking your shell (e.g. bash) followed by the script name. If you don't know what shell you are running, type "echo $SHELL" at the prompt.