This recipe may not seem useful, but it can be used to emulate the stack data structure in Bash.
Printing lines in the reverse order
Getting ready
The simplest way to accomplish this is with the tac command (the reverse of cat). The task can also be done with awk.
How to do it...
We will first see how to do this with tac.
- The syntax of tac is as follows:
tac file1 file2 ...
 The tac command can also read from stdin:
$ seq 5 | tac 5 4 3 2 1
 The default line separator for tac is \n. The -s option will redefine this:
$ echo "1,2...