Suppose we have a script like this
#!/bin/sh echo "hello"
hello.sh and is made executable with
chmod u+x hello.sh
Now what is the difference between the following commands.
./hello.sh # A sh hello.sh # B . hello.sh # C
All of them produce the same output
A, the script is executed as an executable, so the system
looks at the first line of the script for the shebang
executes the script with
B the executable
sh is directly
told to run the file. So here
B do the same thing.
( Notice that you don’t need the script to be executable for the later )
To Be continued…