在bash中的目录名称中使用逗号进行卷曲请求 [英] Curl request with comma in the directory name in bash
本文介绍了在bash中的目录名称中使用逗号进行卷曲请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在使用bash命令行在名称中带有逗号的目录中执行curl请求时遇到问题.
I have problem to execute curl request in the directory has comma in the name using bash command line.
curl --request POST --form "file=@$PWD/input_file" http://HOSTURL.com > output_file
如果目录名称为
测试"有效
测试测试"有效
测试,测试"无效.
我尝试了多种方法来转义字符,例如引号,反斜线,更改IFS ...,但仍然出现错误无法创建formpost数据".有人可以建议我该如何对待这样的目录名?
I tried many ways to escape characters like quotations, back slush, changing IFS... but still getting error "failed creating formpost data". Could someone advise how I should treat such directory names?
推荐答案
这似乎是 curl
不能处理的情况.但是,通过在stdin上传递文件名,就可以避免完全需要它来正确解析该值.
This looks like a case curl
isn't designed to handle. However, by passing the filename on stdin, you can avoid needing it to correctly parse that value at all.
curl --request POST --form "file=@-" http://HOSTURL.com <input_file >output_file
这篇关于在bash中的目录名称中使用逗号进行卷曲请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文