无法从 Zsh 获取 Google 搜索工作

发布于 2024-07-18 20:51:06 字数 474 浏览 3 评论 0原文

我的 .Zshrc 中有以下代码

function google; {
             $VIEW "http://www.google.com/search?q='url-encode "${(j: :)@}"'"
     }

我得到

google masi                                         
google:1: no such file or directory: http://www.google.com/search?q='url-encode masi'

如何您可以在 Zsh 中使用 Google 搜索吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

只是一片海 2024-07-25 20:51:06

以下解决了 Mac

function google; {
             open "http://www.google.com/search?q='url-encode "${(j: :)@}"'"
     }

和 Ubuntu 中的问题

function google; {
             gnome-open "http://www.google.com/search?q='url-encode "${(j: :)@}"'"
     }

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: :)@}"'"
     }
岁吢 2024-07-25 20:51:06

对 zsh 一无所知,但看起来您的报价有问题。

看起来它会将 url 评估为

http://www.google.com/search?q='url-encode masi'

“这可能不是您想要的”。 (“masi”的 url 编码版本)?

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') ?

洋洋洒洒 2024-07-25 20:51:06

$VIEW 的价值是多少?

将其设置为网络浏览器或下载器的路径。

What's the value of $VIEW?

Set it to the path of a web browser or downloader.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文