Logo 
Search:

Unix / Linux / Ubuntu Answers

Ask Question   UnAnswered
Home » Forum » Unix / Linux / Ubuntu       RSS Feeds
  on Dec 07 In Unix / Linux / Ubuntu Category.

  
Question Answered By: Adah Miller   on Dec 07

There are two ways to run a script in the bash shell (what you are
most likely to use), as well as other shells I've used.

The obvious way:

abc@flenser$ ./foo

starts another bash shell running as a child of your current bash
shell. This shell runs the commands and exits.

The other way, sourcing a script is done like this:

abc@flenser$ . foo

(notice the space between the "." and "foo") This method causes your
current shell to execute the commands in the script rather than
starting a new shell to do it. The reason you might want to do this is
that any changes you make to the environment when you source a shell
affect the shell that you are running interactively, the other way
does not allow this.

Share: 

 

This Question has 8 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Source a script Or get search suggestion and latest updates.


Tagged: