Unable to get Google Search work from Zsh
-
03-07-2019 - |
Question
I have the following code in my .Zshrc
function google; {
$VIEW "http://www.google.com/search?q='url-encode "${(j: :)@}"'"
}
I get
google masi
google:1: no such file or directory: http://www.google.com/search?q='url-encode masi'
How can you get Google Search to work in Zsh?
Solution
What's the value of $VIEW?
Set it to the path of a web browser or downloader.
OTHER TIPS
The following solves the problem in Mac
function google; {
open "http://www.google.com/search?q='url-encode "${(j: :)@}"'"
}
and in Ubuntu
function google; {
gnome-open "http://www.google.com/search?q='url-encode "${(j: :)@}"'"
}
Don't know anything about zsh but looks like you've got a problem with your quotes.
Looks like it evaluates the url to being
http://www.google.com/search?q='url-encode masi'
Which probably isn't what you were after. (url encoded version of 'masi') ?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow