First, hello everyone. I use this site a lot, but I don't know what I'm doing wrong, so asking the right questions eludes me. I've googled 'variable expansion' & a few other phrases, but I don't really know what to search for. The posts I found here at LQ ("Click Here to Find Similar Threads") shows more stuff I don't yet understand. I want to make a function in this script to read a user's decision about which site to visit - there are choices 1 to 5, and 6 is exit.
Code:
visit_sites() {
echo "\v Which site?\n"
choice=" \n 1. blah \n 2. blah \n 3. blah \n 4. blah \n 5. blah \n 6. Quit."
echo " Choose from 1 to 6 & hit Enter: \n $choice\n"
read site
case $site in
1) $site="blah"
2) etc., thru 5
6) echo "\v Auf wiedersehen.\n"
exit 0
;;
esac
}
These variants (& many snipped for the sake of space)
"blah"___$"{blah}"___"{blah}"___$(blah)___$("blah")___$"(blah)"___'blah'___$'{blah}'___'{blah}'___$' blah'___$('blah')___$'(blah)'
& each of these prefaced with eval, but they all yield:
./test.sh: 59:
1=whatever i tried above: not found
I've also tried if/elif instead of a case but get the same error. I don't know what I'm doing wrong. I want that 1 (and 2 to 5) to become a FQDN, and pass it to the next function, get_browser(), even though $site has already been assigned 1 (or 2 to 5) as a value.
What should I read to learn how to do this?
Thanks.
32-bit Athlon, Ubuntu 8.04-1