first time poster here but I have ocasionally dipped my toes into linux from time to time. This one for whatever reason has me pulling out what little hair i have left.
I have installed the latest ubuntu and have everything working great so far. I wanted to have a script that would launch mame along with a game which i wanted to then launch at startup. I installed mame via the snap directory and got everything running fine. I created a shell script with simply:
#!/usr/bin/bash
mame pacman
I proceeded to give it using chmod +x command and execute the script as a program. When i do i receive the following error: failed to execute child process /home/jay/snap/mame/pacman.sh": failed to execve : no such file or directory.
I’ve read just about every article i could about creating scripts and watched at least 3 youtube videos. I then decided to try the same but launching firefox and receive the same error. There’s gotta be something I’m doing wrong here but can’t figure out what. The commands work perfectly if i type them out in a terminal.
Any help you could give me would be greatly appreciated.
The script is fine — the problem is the very first line.
#!/usr/bin/bash
There is no /usr/bin/bash on Ubuntu (bash lives in /bin/bash).
So when you mark the file executable and double-click it, the kernel tries to
run /usr/bin/bash … and throws “No such file or directory”.
Fix in two minutes
Open the file and change the she-bang to either of these:
Well, if you do not actually use any bash specific functions (like variable arrays and whatnot) and do not want to load a 5MB shell binary into RAM just for running a small script you should even switch this to /bin/sh which links to dash in Ubuntu and debian, it will act faster and is only a few kilobyte big … this will even be more portable in the end
Shouldn’t it be the other way round since UsrMerge? And with UsrMerge /bin should be a symbolic link to /usr/bin. As far as I understand this both should work.