Forum: PC-Programmierung MSYS2 für Windows


von Lothar (Gast)


Lesenswert?

Nutzt hier jemand MSYS2 für Windows? Im "alten" MSYS konnte man ein 
Shell Skript direkt ausführen. In MSYS2 nicht:

~/helloworld
$ helloworld.sh
sh: helloworld.sh: command not found

Es geht nur so:

~/helloworld
$ /usr/bin/sh helloworld.sh

Was muss ich da konfigurieren, damit es direkt geht?

https://www.msys2.org/

Beitrag #6578980 wurde vom Autor gelöscht.
von Hmmm (Gast)


Lesenswert?

Lothar schrieb:
> $ helloworld.sh
> sh: helloworld.sh: command not found

Wenn . nicht in $PATH steht (was es auch nicht sollte), ./helloworld.sh

von Lothar (Gast)


Lesenswert?

Das geht. Obwohl es kein Executable ist:

~/helloworld
$ ./script.sh

Wenn man #!/bin/sh einfügt, wird es für MSYS2 zum Executable - chmod hat 
dagegen keinen Effekt:

~/helloworld
$ ls -l
-rw-r--r-- 1 xxxxxx None     23 Feb  7 19:54 helloworld.bat
-rw-r--r-- 1 xxxxxx None    117 Feb  7 19:31 helloworld.cpp
-rwxr-xr-x 1 xxxxxx None 291400 Feb  8 03:16 helloworld.exe
-rw-r--r-- 1 xxxxxx None     38 Feb  8 03:14 script.sh
-rwxr-xr-x 1 xxxxxx None     49 Feb  8 03:15 script_bash.sh

Macht aber keinen Unterschied:

~/helloworld
$ ./script_bash.sh

Da das hier auch geht, sh ist ja im $PATH, werde ich wohl das nehmen:

~/helloworld
$ sh script.sh

Aber wie gesagt, MSYS hat einfach alles versucht auszuführen. Da 
brauchte es das alles nicht.

Beitrag #6582017 wurde von einem Moderator gelöscht.
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.