Learning BASH 4

Learning BASH 4

Carrying on from my previous post – http://zleap.net/learning-bash-3

Just looking at the Bash Programming How_to,  this is a great document despite being nearly 20 years old.

in Section 9 – user interfaces there is the following program

#!/bin/bash
OPTIONS="HELLO QUIT"
select opt in $OPTIONS; do
if["$opt"="QUIT"];then
echo done
exit
elif["$opt"="HELLO"];then
echo"Hello, World"
else
#clear
echo"bad option"
fi
done

This works really well only the user get told the repl.it process died unexpectedly.

I managed to fix this by altering the program very slightly.  In the example below remove the exit statement

Again if needed, a direct link https://repl.it/@zleap/bashmenush

I have also made this a little more friendly by adding this as line 2

echo “Please choose an option”

I think this probably demonstrates key skills such as problem solving.

Please feel free to discuss further via the repl.it forums or via twitter @zleap2018. You may also want to follow @replit.

I can also be contacted on friendi.ca