📅 2021-Apr-07 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ bash, error ⬩ 📚 Archive
I had a few repetitive commands that I pasted into a text file and created a Bash script from it. I made the script file executable. When I ran the script, I got this error:
$ ./foobar.sh Failed to execute process './foobar.sh'. Reason: exec: Exec format error The file './foobar.sh' is marked as an executable but could not be run by the operating system.
The Bash script file was so small and simple that this error stumped me for a moment.
On closer examination, I found that I had mistakenly put a space before the shebang and that was throwing this error:
#!/bin/bash ^-- space