gpt4 book ai didi

linux - linux命令行中的分号

转载 作者:IT王子 更新时间:2023-10-28 23:52:16 25 4
gpt4 key购买 nike

我通过提供输入作为命令行在 Linux 中运行我的应用程序。我的输入字段包含一个内部包含“;”(分号)的参数。(例如:123;434;5464)。这将使用 UTF8String 编码和发送进行解析。但是当我这样使用时,最初我得到了,

 bash: 434: command not found
bash: 5464: command not found

当我捕获流量时,输出仅包含 123 而不是 123;434;5464但是如果我给出没有分号(例如:123:434:5464),则不会像 123:434:5464 那样正确输出任何问题

告诉我如何通过使用分号来提供命令行输入作为输出。使用分号时是否有任何特定的语法要使用。我像下面这样运行

./runASR.sh -ip 10.78.242.4 -port 3868 -sce 10.78.241.206 -id 85;167838865;1385433280

其中 -id 字段包含有问题的值。

最佳答案

; 被视为命令结束 字符。所以 123;456;5464 到 bash 实际上是 3 个命令。要传递此类元字符,请使用转义字符 \ 对其进行转义。

./command 123\;456\;5464

或者用单引号 (double quote evaluates the inner string) 引用它(感谢 Triplee,我忘了提到这个)

./command '123;456;5464'

关于linux - linux命令行中的分号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20233934/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com