stuck on bash variable "expansion"?
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() { "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 |
When assigning to a variable, do not prefix the name with $.
i.e. Code:
site="whatever" # good Code:
echo "you chose $site" # good |
thanks for your patience
doh! :rolleyes: I'm a genius. Thanks!!
|
All times are GMT -5. The time now is 02:10 AM. |