I am trying to execute bash script on windows using cygwin but getting error as commands not found
sample : test.sh
#!/bin/bash
ls
and I am executing it as
C:\Apps\cygwin64\bin\bash.exe /cygdrive/g/Scripts/test.sh
getting error as test.sh: line 2: ls: command not found
If you are running this from the Windows command prompt, or from a Windows batch file, in order for your PATH and other environment variables to be set correctly, you need to invoke the --login
option. Run your command as follows:
C:\Apps\cygwin64\bin\bash.exe --login -c "/cygdrive/g/Scripts/test.sh"
This should do the trick.