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 16

  1. What is parameter substitution?Nothing more than the run-time substitution of the variable name with its value at that moment.
  2. How can we include default values for our defined variables? With the ${variable:-value} syntax, where variable is the name and value the default value. This will only be used if the value is null or empty ('').
  3. How can we use parameter expansion to handle missing parameter values?While you would normally use an if [[ -z ${variable} ]]; then, parameter expansion allows you to use the following syntax to generate an error message and exit 1: ${1:?Name not supplied!}
  4. What does ${#*} do?It is the same as $#, which we use to determine the number of arguments passed to our shell script. The general ${#name} ...
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