Skip to Content
Learn Linux Shell Scripting - Fundamentals of Bash 4.4
book

Learn Linux Shell Scripting - Fundamentals of Bash 4.4

by Sebastiaan Tammer
December 2018
Beginner
452 pages
12h 17m
English
Packt Publishing
Content preview from Learn Linux Shell Scripting - Fundamentals of Bash 4.4

Test shorthand

The test command is one of the most important commands we have in our shell scripting arsenal. Because shell scripts can often be fragile, especially where user input is concerned, we want to make these as robust as possible. While explaining every aspect of the test command would take a whole chapter, the following are the things test can do:

  • Check whether a file exists
  • Check whether a directory exists
  • Check whether a variable is not empty
  • Check whether two variables have the same values
  • Check whether FILE1 is older than FILE2
  • Check whether INTEGER1 is greater than INTEGER2

And so on and on and on—this should give you at least an impression of things you can check with test. In the Further reading section, we have included ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Bash Scripting Fundamentals

Bash Scripting Fundamentals

Sander van Vugt

Publisher Resources

ISBN: 9781788995597Supplemental Content