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

c program to implement unix/linux command to block the signal ctrl-c and ctrl-\ signal during the execution ls -l|wc -l

1 Answers  


How do I set bash as default shell mac?

1 Answers  


c program to display the information of given file similar to givan by the unix or linux command ls -l

1 Answers   IBM,


What does path stand for?

1 Answers  


What is the command for " how many shell is running in your system or how many shell supported by your system " ?.

3 Answers  


c program which accept one argument as a directory name and prints all the file name along with its inode number and total count of the file in directory

1 Answers  


What is the difference between grep and egrep?

1 Answers  


What is the fastest scripting language?

1 Answers  


Print a given number, in reverse order using a shell script such that the input is provided using command line argument only.

1 Answers  


Hi All, Is it possible to create one file name only space or space in file name in UNIX and we can able to run that on Unix?

2 Answers   Cap Gemini,


What is ms powershell?

1 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  


Categories