07-23-2023, 10:35 AM
I have a sh/bash script that needs to call a batch file with parameters (parameters are file names and are given in DOS/Windows format).
Basically I have:
**script.sh**
#!/bin/sh
declare var1=$1
declare var2=$2
dosomething var1 var2
...
<invoke batch script> var1 var2
...
dosomethingelse
I'm using `GNU bash, version 3.1.0(3)-release (i686-pc-msys)` as the shell, on `msysgit`
The problem is that when i run from script:
`$COMSPEC /c batchfile param1 param2`
either I get an "empty prompt" which looks like bash, but no command result is displayed on the console, either `cmd.exe` start, but doesn't execute the script.
I've tried quoting the params to bash like this:
$COMSPEC /c \"batchfile param1 param2\"
$COMSPEC /c \"\"batchfile param1 param2\"\"
$COMSPEC /c \"\"batchfile \"param1\" \"param2\"\"\"
But I didn't get any result.
Basically I have:
**script.sh**
#!/bin/sh
declare var1=$1
declare var2=$2
dosomething var1 var2
...
<invoke batch script> var1 var2
...
dosomethingelse
I'm using `GNU bash, version 3.1.0(3)-release (i686-pc-msys)` as the shell, on `msysgit`
The problem is that when i run from script:
`$COMSPEC /c batchfile param1 param2`
either I get an "empty prompt" which looks like bash, but no command result is displayed on the console, either `cmd.exe` start, but doesn't execute the script.
I've tried quoting the params to bash like this:
$COMSPEC /c \"batchfile param1 param2\"
$COMSPEC /c \"\"batchfile param1 param2\"\"
$COMSPEC /c \"\"batchfile \"param1\" \"param2\"\"\"
But I didn't get any result.