2

From a long time i am struggling for with this program. I am having a shell script which accepts parameters as version number and path for the files. then that script creates Zip file with the name of version number congaing all file files to the folder.

I have installed Cygwin on following path D:/cygwin. I am coping required files to same location where cygwin is installed D:\cygwin\bin

Command

D:/cygwin/bin/bash -c '/bin/test/app.sh 04.10 D:\cygwin\bin\ Test_files

Or Can any one please suggest how to run shell script in java using Cygwin.

Rewriting the Problem:-

When i am trying to run following Command in command prompt it gives error

sh app.sh AK-RD 02.20 D:\cygwin\bin\Test_files

Error:-C:\Documents and Settings\sh app.sh AK-RD 02.20 D:\cygwin\bin\Test_files

/usr/bin/app.sh: line 51: lib/lib.sh: No such file or directory

But if i run the same command at

D:cygwin\bin\Test>sh app.sh AK-RD 02.20 D:\cygwin\bin\Test_files

It works fine. Can any one suggest me how to avoid this kind of errors.

1 Answer 1

4
Runtime run = Runtime.getRuntime();
Process p = run.exec("D:/cygwin/bin/bash -c \'/bin/test/app.sh 04.10 D:\cygwin\bin\ Test_files");
p.waitFor();
Sign up to request clarification or add additional context in comments.

1 Comment

Beware of java excape characters in string literals. I think this is more correct: D:/cygwin/bin/bash -c \\'/bin/test/app.sh 04.10 D:\\cygwin\\bin\\ Test_files

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.