How to merge parameters separated by space?
by Patrosk from LinuxQuestions.org on (#6FW2C)
Hi, I am new to linux. I want to know how to make an parameter be read as a string. Or how to make a phase be read as only one parameter? I am trying to run the following comand:
w3m www.google.com/search?q=test
To open the browser already making the search on Google (for educational purposes I'm making kind of a shortcut for this)
This runs perfectly but, when I add a full phrase to search, doesn't work:
w3m www.google.com/search?q=test test
I think that's because the w3m program thinks that "www.google.com/search?q=test" is one parameter and "test" is another one because they are separated by with the space.
I tried to make an shortcut using
alias wsearch='f(){ w3m www.google.com/search?q="$@"; unset -f f; }; f'
Because I thought using "$@" make all the parameters come to this, but because of the space in between the words still doesn't work. Now I'm thinking that if all the words after the comand "wsearch" became a string, the space will not cause this error. Or if I can make all the parameters count as only one parameter, will make it too.
Any ideas? Thanks a lot.
w3m www.google.com/search?q=test
To open the browser already making the search on Google (for educational purposes I'm making kind of a shortcut for this)
This runs perfectly but, when I add a full phrase to search, doesn't work:
w3m www.google.com/search?q=test test
I think that's because the w3m program thinks that "www.google.com/search?q=test" is one parameter and "test" is another one because they are separated by with the space.
I tried to make an shortcut using
alias wsearch='f(){ w3m www.google.com/search?q="$@"; unset -f f; }; f'
Because I thought using "$@" make all the parameters come to this, but because of the space in between the words still doesn't work. Now I'm thinking that if all the words after the comand "wsearch" became a string, the space will not cause this error. Or if I can make all the parameters count as only one parameter, will make it too.
Any ideas? Thanks a lot.