Linux中命令行上的分号 [英] Semicolon on command line in linux

查看:43
本文介绍了Linux中命令行上的分号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

i am running my application in linux by providing inputs as command line. My input field contain an argument which contains ";"(semicolon) internally.(For example:123;434;5464). This will be parsed using UTF8String encode and send. But when i am using like this, in initial itself i am getting,

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

当我捕获流量时,输出仅包含123而不是123; 434; 5464但是,如果我不使用分号(Ex:123:434:5464),则无法正常输出任何问题,如123:434:5464

And when i capture traffic the output contains only 123 instead 123;434;5464 But if i give without semicolon (Ex:123:434:5464),not getting any problem output coming properly as 123:434:5464

为我指出如何使用分号将命令行输入作为输出.使用分号时是否有任何特定的语法要使用.我正在像下面那样奔跑

Point me how to give command line input by using semicolon as to come output. Is there any particular syntax to use while doing with semicolon. I am running like below

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

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

where -id field contain that value with issue.

推荐答案

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

; is treated an end of command character. So 123;456;5464 to bash is in fact 3 commands. To pass such meta-characters escape it with escape character \.

./command 123\;456\;5464

或者仅用单引号将其引号(双引号可计算内部字符串)(感谢Triplee,我忘了提及这个)

Or Just quote it with single quote (double quote evaluates the inner string) (Thanks Triplee, I forgot to mention this)

./command '123;456;5464'

这篇关于Linux中命令行上的分号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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