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 is use of "cut" command?

3 Answers  


How do I edit a .sh file?

0 Answers  


‎What is a shell? · ‎Types of shell · ‎what is shell scripting?

0 Answers  


In a file , how to retrieve the lines which are the multiples of 50 ? like 50,100,150th lines etc.

9 Answers   Amazon,


What is a beat in a script?

0 Answers  






What is shell chemistry?

0 Answers  


How do you read arguments in a shell program - $1, $2 ..?

4 Answers  


How do I run a bin bash script?

0 Answers  


Is it possible to substitute "ls" command in the place of "echo" command?

0 Answers  


How to make userdefined variables to available for all other shells?

4 Answers  


how do you write sql queries using shell script for eg:- we have databae table like EMPNO,ENAME,SAL,DEPTNO columns in EMP table how you display EMPNO,SAL FIELDS from emp in SHELL SCRIPT please explain with an example

4 Answers  


How to declare functions in unix shell script?

4 Answers  


Categories