Semicolon on command line in linux

后端 未结 1 1017
陌清茗
陌清茗 2021-02-04 03:09

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

相关标签:
1条回答
  • 2021-02-04 03:50

    ; 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'
    
    0 讨论(0)
提交回复
热议问题