What's the difference b/w running a script using ./script-name and running it using sh scriptname.sh ? I have this script which runs ok when I run it using ./script.sh but doesn't when I run it using sh script.sh . What changes I have to make it work?
Asked
Active
Viewed 413 times
0
-
Didn't this get asked before?http://stackoverflow.com/questions/30907988/what-is-the-difference-between-example-sh-and-sh-example-sh – 123 Jun 18 '15 at 12:31
1 Answers
0
./script_name
require the script to have x
permission for the user, and its first line shabang
indicate its interpreter. e.g #! /bin/bash
interpreter_name script_name
don't require the x
permission.

Eric
- 22,183
- 20
- 145
- 196