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

Case modification

Next up is another parameter expansion we've already briefly seen: case modification. In this instance, case refers to lowercase and uppercase letters.

In the yes-no-optimized.sh script we originally created in Chapter 9, Error Checking and Handling, we had the following instructions:

reader@ubuntu:~/scripts/chapter_09$ cat yes-no-optimized.sh <SNIPPED>read -p "Do you like this question? " reply_variable# See if the user responded positively.if [[ ${reply_variable,,} = 'y' || ${reply_variable,,} = 'yes' ]]; then  echo "Great, I worked really hard on it!"  exit 0fi# Maybe the user responded negatively?if [[ ${reply_variable^^} = 'N' || ${reply_variable^^} = 'NO' ]]; then  echo "You did not? But I worked so hard on it!" exit ...
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