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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different variables present in linux shell?

610


Can you write a script to portray how set –x works?

550


What is the use of break command?

586


What is sudo command?

548


Is shell scripting a language?

581






shell script for reverse the string

914


Where are cowrie shells found?

574


What is the use of .sh file?

598


What is scripting autism?

700


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

614


How do you create a shortcut in linux?

591


How can any user find out all information about a specific user like his default shell, real-life name, default directory, when and how long he has been using the system?

716


What is bash coding?

497


What is shell application?

567


What is wc in shell script?

557