December 2018
Beginner
452 pages
12h 17m
English
Exclamations marks are normally used to give text some emphasis, but under Bash they are actually a shell keyword:
reader@ubuntu:~$ type -a !! is a shell keyword
While the term "shell keyword" does not really give us a great indication of what it does, there are multiple things we can accomplish with the exclamation mark. One we have already seen: if we want to negate a test, we can supply the exclamation mark within the check. If you'd like to verify this on your Terminal, try the following with either true or false:
reader@ubuntu:~$ truereader@ubuntu:~$ echo $?0reader@ubuntu:~$ ! truereader@ubuntu:~$ echo $?1
As you can see, the exclamation mark reverses the exit status: true becomes false, and false becomes true. ...