在wget bash命令中转义(Escaping in wget bash command)

编程入门 行业动态 更新时间:2024-10-24 16:31:05
在wget bash命令中转义(Escaping in wget bash command)

wget -q -T 60 --retry-connrefused -t 5 --waitretry=60 --user=ftp2.company.com|company2013 --password=!company2013 -N -P data/parser/company/ ftp://ftp2.company.com/Production/somedata.zip

我在使用此命令时遇到问题,因为密码包含感叹号。 我尝试使用\转义,尝试使用单引号,然后输出:

wget: missing URL

要么

bash: !company2013: event not found

这真是令人失望......

wget -q -T 60 --retry-connrefused -t 5 --waitretry=60 --user=ftp2.company.com|company2013 --password=!company2013 -N -P data/parser/company/ ftp://ftp2.company.com/Production/somedata.zip

I'm having trouble with this command, because the password contains an exclamation mark. I tried escaping with \, tried single quotes, and it either gives the output:

wget: missing URL

or

bash: !company2013: event not found

This is really demotivating...

最满意答案

也许这部分需要引用以防止它被视为另一个命令的管道。

--user='ftp2.company.com|company2013'

这也是为了防止历史扩张!:

--password='!company2013'

最后:

wget -q -T 60 --retry-connrefused -t 5 --waitretry=60 --user='ftp2.company.com|company2013' --password='!company2013' -N -P data/parser/company/ ftp://ftp2.company.com/Production/somedata.zip

如果稍后他们有空格,引用其他部分也是一个好主意:

wget -q -T 60 --retry-connrefused -t 5 --waitretry=60 --user='ftp2.company.com|company2013' --password='!company2013' -N -P "data/parser/company/" "ftp://ftp2.company.com/Production/somedata.zip"

Perhaps this part needs to be quoted to prevent it from being seen as a pipe to another command.

--user='ftp2.company.com|company2013'

And this one too to prevent history expansion with !:

--password='!company2013'

Final:

wget -q -T 60 --retry-connrefused -t 5 --waitretry=60 --user='ftp2.company.com|company2013' --password='!company2013' -N -P data/parser/company/ ftp://ftp2.company.com/Production/somedata.zip

And it's also a good idea to quote the other parts if on later time they have spaces:

wget -q -T 60 --retry-connrefused -t 5 --waitretry=60 --user='ftp2.company.com|company2013' --password='!company2013' -N -P "data/parser/company/" "ftp://ftp2.company.com/Production/somedata.zip"

更多推荐

本文发布于:2023-07-16 07:29:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1125444.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:命令   bash   wget   Escaping   command

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!