January 2024
Beginner to intermediate
300 pages
6h 42m
English
Sometimes, you’ll find yourself repeating the same few commands over and over, perhaps with slight variations. You reach the point of frustration, and say, “That’s it; I’m scripting this.” Being a CLI wizard, you do the following:
tail -n 20 ~/.bash_history > myscript.sh to create a file that contains the last 20 Bash commands you ran.bash myscript.sh to execute it.Although this isn’t the recommended procedure (we’ll get to that in this chapter), it’s a perfectly valid way to create and run a Bash script.
This chapter is a Bash scripting crash course. Like any programming crash course, it is completely useless unless you actually follow along, type in all the code yourself, and run it in ...
Read now
Unlock full access