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

Chapter 9

  1. Why do we need an exit status? So commands can signal to their callers if they succeeded or failed in a simple manner.
  2. What is the difference between exit status, exit code and return code? An exit code and return code refer to the same thing. An exit status is a concept, which is brought to life by the exit/return code.
  1. Which flag do we use with test to test for:
    • An existing directory -d
    • A writable file -w
    • An existing symbolic link -h (or -L)
  2. What is the preferred shorthand syntax for test -d /tmp/? [[ -d /tmp/ ]]. Note that a space after [[ and before ]] is mandatory, or the command will fail!
  3. How can we print debug information in a Bash session? Set the -x flag, either in the shell with set -x or when calling a script with ...
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