Using Quotes within getRuntime().exec

前端 未结 6 803
不思量自难忘°
不思量自难忘° 2020-11-30 06:46

I\'d like to invoke bash using a string as input. Something like:

sh -l -c \"./foo\"

I\'d like to do this from Java. Unfortunately, when I

6条回答
  •  渐次进展
    2020-11-30 07:03

    The cause for this error is most likely a missing syntax token that bash expects but the string you pass ends before bash encountered it. Look for ifs, fors etc. that have no closing fi or done.

提交回复
热议问题