Issue with Command Line arguments which got spaces in it

前端 未结 5 1908
心在旅途
心在旅途 2020-11-29 09:41

I have a Java program which I\'m executing in a Linux environment through a bash script.

This is my simple bash script, which accepts a String.

#!/bi         


        
5条回答
  •  有刺的猬
    2020-11-29 10:11

    When you pass command line arguments with spaces, they are taken as space separated arguments, and are splitted on space. So, you don't actually have a single argument, but multiple arguments.

    If you want to pass arguments with spaces, use quotes:

    java classname "Apple Inc. 2013 Jul 05 395.00 Call"
    

提交回复
热议问题