I have git for windows 2.5.2 (64-bit version), downloaded from: https://git-scm.com/download/win
All I wanted was to create a .sh that would commit/push my work for me. I wrote the script and when I try to run it I get an error like:
"#!/bin/sh: No such file or directory"
As you can see I have my PATH set for my git-bash and my git-sh (also for my sh.exe and my bash.exe)
PATH-> "C:\Program Files\Git\bin\;C:\Program Files\Git\mingw64\;"
I also have my ~/.bash_profile:
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
My ~/.profile:
#!/bin/sh.exe
#
# Get the aliases and functions
#
if [ -f ${HOME}/.bashrc ]
then
. ${HOME}/.bashrc
fi
export CVS_RSH="ssh"
export EDITOR="/usr/bin/vim"
export HISTSIZE="500"
export PATH="${HOME}/bin:${PATH}"
And my simple script.sh:
#!/bin/sh.exe
P_J="Le/Prjt/swks/games"
GITLAB_USER='myuser'
GITLAB_PASSWORD='mypass'
P_JG='G Select'
NAME_OF_REP='g-select'
cd $P_J || EXIT
cd "$P_JG" || EXIT
#git add -A
#git commit -m "$(date)"
#git push https://$GITLAB_USER:[email protected]/$GITLAB_USER/$NAME_OF_REP.git
From my Git-Bash, here is an "echo $PATH":
$ echo $PATH /c/Users/UserP/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/ProgramData/Oracle/Java/javapath:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Program Files/Java/jre1.8.0_51/bin:/c/Program Files (x86)/Android/android-sdk/platform-tools:/bin:/mingw64:/usr/bin/vendor_perl:/usr/bin/core_perl
As I said, when opening git-bash and running my simple .sh I get this error:
./script.sh: line 1: #!/bin/sh.exe: No such file or directory
The problem seems to be when creating a variable on my shellscript. Does anyone have any idea of what may be causing this problem?
Thanks in advance!
=operator. It must beVARNAME=VALUE, whith no unquoted whitespace anywhere, (and quoted whitespace only permitted withinVALUE)..exe". Agreed, we don't normally specify.exein the shebang, but with MSYS, from MinGW.org, on 32-bit Windows7, it makes no difference either way -- both#!/bin/shand#!/bin/sh.exeWJFFM. Maybe the git port, for 64-bit windows has broken this?type sh.exe?