June 2017
Beginner
502 pages
11h 26m
English
This is new in bash 4.0, it forces upper case conversion in the parameter substitution:
zarrelli:~$ cat parm-sub.sh #!/bin/bashecho "Hello, can you give me a string of characters?"read my_stringif [[ "$my_string" =~ ^[[:alpha:]]*$ ]] then echo "Printing the variable \$my_string as \${my_string}: ${my_string}" "| No modifications" echo "Printing the variable \$my_string as \${my_string^}: ${my_string^}" "| The first char is uppercase" echo "Printing the variable \$my_string as \${my_string^^}: ${my_string^^}" "| All chars are uppercase" echo "Printing the variable \$my_string as \${my_string,}: ${my_string,}" "| The first char is lowercase" echo "Printing the variable \$my_string as \${my_string,,}: ${my_string,,}" ...Read now
Unlock full access