Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Semicolon on command line in linux

Tags:

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 

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 

where -id field contain that value with issue.

like image 234
ramulu ponnam Avatar asked Nov 27 '13 04:11

ramulu ponnam


People also ask

What does a semicolon do in bash?

Semi-colons and newlines separate synchronous commands from each other. Use a semi-colon or a new line to end a command and begin a new one. The first command will be executed synchronously, which means that Bash will wait for it to end before running the next command.

What is colon in Linux command?

It is used when a command is needed, as in the then condition of an if command, but nothing is to be done by the command.

What does '$' mean in Linux?

BASICS. Syntax for this manual. Remember the UNIX/LINUX command line is case sensitive! "$" indicates start of command. "#" indicates end of command and start of comment.

What is the result when two commands are run separated by semicolons?

A command line can consist of multiple commands. Each command is separated by a semicolon, and the command line is terminated with a newline. The exit status is that of the last command in the chain of commands. Output from the date command will be redirected to the whoandwhen file.


1 Answers

; 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 

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

./command '123;456;5464' 
like image 120
Shiplu Mokaddim Avatar answered Sep 28 '22 07:09

Shiplu Mokaddim