When the jar program is executed with different terminals, the args content received by main will be inconsistent.

< H2 > if the jar program is executed with different terminals, the args content received by main will be inconsistent < / H2 > The

code is simple: print the args content in turn

   

from the results, git bash swallowed -- dw-hive-auth="" after the equal sign in single quotation marks (it has been tested that execution on the mac terminal will also swallow ").
it is inferred that the terminal execution logic is different. Is there any relevant data to explain this phenomenon?

Dec.08,2021

your two quotation marks are obviously different, one is full-width and the other is half-width (if my eyes are not deceiving me).


single quotes are special symbols in bash, but not in windows command prompts.

in bash, you can try escaping with backslashes, xxx=''
or wrapped in double quotes. Most (but not all) characters in double quotes will be treated as normal characters
xxx= "'" (two single quotes inside double quotes)

  • Execute shell command in java

    Process process = null; process = RunTime.getRunTime (). Exec ( "cp aa.txt bb.txt "); process.waitFor (); I want to execute the shell command in java and find this function on the Internet, but I have tested it several times. Isn t the process.wait...

    Mar.22,2021
Menu