【问题标题】:SUSE Linux terminal is not recognizing some characters like "&", "?", "/"SUSE Linux 终端无法识别某些字符,例如“&”、“?”、“/”
【发布时间】:2015-06-07 08:03:56
【问题描述】:

当我在终端运行时

curl https://api.box.com/2.0/folders/{id}/items?limit=100&offset=0 -H "Authorization: Bearer access_token" 

使用有效的 access_token 它会给我这个响应。

If '-H' is not a typo you can run the following command to lookup the package that contains the binary: 
command-not-found -H 
-bash: -H: command not found 

我正在使用 SUSE Linux Enterprise Server 11 SP3。

【问题讨论】:

  • 你可能不得不逃避它们:curl https://xxxx\&yyyy
  • 感谢 fedorqui ..它对我有用...我这样做了: curl api.box.com/2.0/folders{id}/items\?limit=100\&offset=0 -H "Authorization: Bearer access_token"
  • 不错!我也只是将其发布为答案,因此很明显您的问题已解决。由于您是新来的,如果您的问题已经解决,请不要忘记将答案标记为已接受。您可以单击答案旁边的复选标记将其从空心切换为绿色。如有任何问题,请参阅Help Center > Asking

标签: linux curl suse


【解决方案1】:

您提到的所有这些字符都必须转义以防止它们被 bash 解释。

例如,而不是:

curl https://www.example.com/r?v=1&w=2

你需要使用:

curl https://www.example.com/r\?v=1\&w=2
                              ^^   ^^

在你的情况下:

curl https://api.box.com/2.0/folders/\{id\}/items\?limit=100\&offset=0 -H "Authorization: Bearer access_token" 
                                     ^^  ^^      ^^         ^^

【讨论】:

    猜你喜欢
    • 2021-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-10
    • 2016-02-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-10
    相关资源
    最近更新 更多