If you change the bash special parameter `$@` to `$*` you won't need the urlencoding command substitution.
you're right (just tried it) but why? What's the difference in the output between them?
When `$@` is in double quotes the arguments are split on the first character of IFS (by default a space) and each argument is individually quoted, but with `$*` in double quotes no word splitting occurs and the entire string of arguments is quoted. URLs are one of the few times that it is preferable to use`$*` than `$@`.
These 2 sites have everything there is to know about *good* bash scripting:
1. http://wiki.bash-hackers.org
2. http://mywiki.wooledge.org (Bash Guide, Bash Pitfalls and Bash FAQ)
Bash LaunchBar search template: