Writing Shell Scripts

Placing multiple commands on a single line, either by using the semicolon or piping, is a great way to process data, but it can still get rather tedious. Each time you want to run a set of commands, you need to type them all at the command prompt.

However, Linux also allows us to place multiple commands in a text file, then run the text file as a program from the command line. This is called a shell script, because we’re scripting out commands for the Linux shell to run.

Shell script files are plain text files. To create a shell script file, you just need to use any text editor that you’re comfortable with. If you’re working from a KDE-based graphical desktop, you can use the KWrite or Kate programs, or if you’re using ...

Get Linux Fundamentals, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.