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

If you have a string "one two three", which shell command would you use to extract the strings?

5 Answers  


What are the Different types of shells?

5 Answers  


What are the additional egrep symbols?

2 Answers  


How to debug the problems encountered in the shell script/program?

0 Answers  


What is an inode block?

0 Answers  






Why is used in shell scripting?

0 Answers  


write a scwipt that a) takes exactly one argument, a directory name. b) if the number of argument is more or less than one,print a usage message c) if the argument is not adirectory, print another message d) for the given directory, print the five biggest files and the five files that were most recently modified. e) save the output to a file called q2output.

2 Answers  


How to customise the existing shell?

1 Answers  


How do I stop script errors?

0 Answers  


What are the types of script?

0 Answers  


what is the meaning of First line of shell script ,what is meaning of #! pleas explain brifly

4 Answers  


write a non recursive shell script that accepts any number of arguments and prints them in the reverse order

3 Answers  


Categories