When I created a shell script for the first time and executed it, an error occurred, so make a note.
Create a script file.
$ touch script.sh
The script I was creating is below. A simple script that just displays Hello.
#!/usr/bin/bash
echo Hello
When executed,
$ ./script.sh
I get an error
-bash: ./script.sh: /usr/bin/bash: bad interpreter: No such file or directory
Check which bash you are using because the specified bash is different. What was used here was / bin / bash.
$ which bash
/bin/bash
I was able to execute it by modifying the contents of the script as follows.
#!/bin/bash
echo Hello
I'm a beginner and I don't understand it in the first article, but for the time being. Please let me know if you make a mistake.
Recommended Posts