What is the difference between running a script as
./scriptname.sh and sh scriptname.sh



What is the difference between running a script as ./scriptname.sh and sh scriptname.sh..

Answer / vidhu

while running the script using this "./" script run from
curent location we have to give executable permision to the
script file
By default file contains 644 permissions there is no
execute permission while running it shows error
use `chmod` to give execute permission and run
where as "sh" it runs the script with the help of default
shell

Is This Answer Correct ?    5 Yes 4 No

Post New Answer

More Shell Script Interview Questions

What are the different shells available?

3 Answers  


whta is the use of "exec" command?

1 Answers  


What is difference between shell and bash scripting?

0 Answers  


What are the different methods available to run a shell script?

2 Answers  


How do I run a powershell script?

0 Answers  


what is the difference between writing code in shell and editor?

1 Answers  


Write a shell script to check whether a number is Armstrong number or not?

1 Answers   Flipkart,


wats the she bang statment with syntax?

3 Answers  


how to print the 2-d, 3-d arrays in unix shell script programs please answer thi questio to my mail venusaikumar@gmail.com

0 Answers  


Is cmd a shell?

0 Answers  


How do you schedule a command to run at 4:00 every morning?

5 Answers   Wipro,


What is the difference between grep and egrep?

0 Answers  


Categories