Using Quotes within getRuntime().exec

前端 未结 6 805
不思量自难忘°
不思量自难忘° 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:17

    if I were you, I would write the contents of the string to a temp bashfile and see if bash executes that without any error. If that executes without an error, then I would consider debugging further;

提交回复
热议问题