如何包含一个“&"bash curl 语句中的字符 [英] How to include an '&' character in a bash curl statement

查看:25
本文介绍了如何包含一个“&"bash curl 语句中的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在 bash 中使用 curl 来下载网页,但是 URL 中的 & 符号没有像我希望的那样解释为字符.关于如何让 bash 相信符号 & 只是一个无聊的字符而没有什么特别之处的任何想法?

I'm trying to use curl in bash to download a webpage, but the & symbol in the URL isn't interpreted as a character as I would like. Any ideas on how I can convince bash that the symbol & is just a boring character and nothing special?

推荐答案

& 符号周围加上单引号似乎有效.也就是说,使用像 http://www.example.com/page.asp?arg1=${i}'&'arg2=${j} 这样的 URL 和 curl 返回请求的网页.

Putting single quotes around the & symbol seems to work. That is, using a URL like http://www.example.com/page.asp?arg1=${i}'&'arg2=${j} with curl returns the requested webpage.

这篇关于如何包含一个“&"bash curl 语句中的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆