How-to – Start a SH Shell Script from a Windows Batch BAT Script using CygWin

0
1187
Linux is known for its unique command line, and so cygwin was made for Windows to emulate linux on windows and give windows users what they have been missing out on.

 

The syntax is like this:
<windows path to bash in cygwin> -l -c “<cygwin/linux path to the script1>”
Example:
Lets say I want to start a script called script1.sh
C:\cygwin\bin\bash.exe -l -c “/cygdrive/e/scripts/start.sh”
Note that windows is not case sensitive but linux is…
So these would work:
C:\cygwin\bin\bash.exe -l -c “/cygdrive/e/scripts/start.sh”
C:\CYGWIN\bin\bash.exe -l -c “/cygdrive/e/scripts/start.sh”
C:\cyGWin\BIN\baSH.exe -l -c “/cygdrive/e/scripts/start.sh”
 
But these will not work because the /cygdrive.. part doesn’t match the case of the folders from cygwins/linuxes point of view:
C:\cygwin\bin\bash.exe -l -c “/cygdrive/e/SCRIPT/start.sh”
C:\CYGWIN\bin\bash.exe -l -c “/cygdrive/E/scripts/start.sh”
C:\cyGWin\BIN\baSH.exe -l -c “/cygdrive/e/scripts/START.sh”