What is the difference between the below 2 commands:./myExeSh. /myExeShwhere myExeSh is my executable shell file.

Showing Answers 1 - 2 of 2 Answers

vtian

  • Apr 17th, 2007
 

./myExeSh run the script in another shell.
. /myExeSh executing in  the current shell. All variable in the shell script will leave in the current shell after execution finished.

./myExeSh = sh myExeSh     (I assume you are using sh as shell, the only difference is myExeSh does not required to be executable when using sh myExeSh)
. /myExeSh = source myExeSh

  Was this answer useful?  Yes

penchal

  • Apr 18th, 2007
 

When we run a script, it will be executed in a child shell.
Changes in the child shell will not be reflected in the parent shell.
For reflecting those changes, we use dot(.) command.

For Example ..In a script myExesh.sh ..only one statement is present

Let it be cd $HOME

After executing the script using ./myExesh, you will be present in the same directory where you executed the script.

Now execute the script using . /myExesh. After ececuting the script you will be in the home directory.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions