I am following this post:
http://blog.dotsmart.net/2011/01/27/executing-cygwin-bash-scripts-on-windows/
I need to execute a batch file with an argument and pass this argument to a bash script. The argument is a long file name with spaces, something like FILE WITH SPACES.xlsx.
In Windows:
c> program.cmd "FILE WITH SPACES.xlsx" # Windows adds the quotes to complete the name of the file.
The batch script must pass the name of the file "FILE WITH SPACES.xlsx" to a .sh script, something like this:
# program.sh "FILE WITH SPACES.xlsx"
Here is the problem, the file is passed without the quotes:
# program.sh FILE WITH SPACES.xlsx
The script program.sh has:
#!/bin/sh
anyprogram "$1"
The quotes are not passed and the program anyprogram doesn't locate the file FILE WITH SPACES.xlsx.
i tried escaping the " with \ but not work:
#!/bin/sh
anyprogram "\"$1"\"
Also, with:
#!/bin/sh
anyprogram '"$1"'
None looks to work, any suggestion?
in=\"$*\"thenecho $in..shfile is being done?$iby$*or (when the call is correct)$1.