16.1. Reasons for using a shell script

Shell scripts can save you time in automating repetitive or long tasks and are very powerful. After all, why have a list of commands that does a certain task, where you have to enter the commands manually then look at the output, then decide if it’s the right output you expected? If it is, great, carry on with the next task. If it isn’t, look back to the list to see what to do next. A task can be anything including sorting a file, inserting text into files, migrating files, deleting certain lines from a file, cleaning up old files around the system, doing general administrative work on the system. Creating a script using variables, conditional, arithmetic and iteration constructs, with a touch of system ...

Get Linux and Unix Shell Programming 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.