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

Is shell a scripting language?

576


How to print the first array element?

559


How do we delete all blank lines in a file?

579


Can shell script run on windows?

572


What does it mean to debug a script?

575






What is the best shell scripting language?

545


How to print all array elements and their respective indexes?

512


How do I run a powershell script?

580


What is gui scripting?

607


How do you create a shortcut in linux?

599


What is the syntax of while loop in shell scripting?

575


What is a file basename?

598


How does ls command work?

590


What is bash eval?

552


Explain about login shell?

638