01 / 08
When typing three lines becomes a bother
Say you do this every day.
~ $ df -h > record.txt~ $ du -sk * >> record.txt~ $ date >> record.txtTyping three lines is honestly a bother. And you get the order wrong, or forget a line.
At times like this you think of it this way.
> Write the steps in a file, and call it by name
That file is called a script. You have already seen one: you looked inside ~/bin/greet in chapter 10.
#!/bin/shecho helloThat is a script. Two lines.
What this chapter does is, in fact, half done already.
you can type commands <- you canyou can write to a file <- you can (echo and >>)you can put the execute mark <- you can (chmod +x)It is a combination of chapters 6 and 10. All that is left is the #! on the first line.