Jump to content

source (command)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by C4dn (talk | contribs) at 01:59, 12 April 2012 (Corrected "Tcl script" to "commands executed in the current context", as per the new refs, my testing and experience, and the Talk page.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

source is a Unix command that evaluates the file following the command, as a list of commands, executed in the current context. [1] [2] Frequently the "current context" is a terminal window into which the user is typing commands during an interactive session. The source command can be abbreviated as just a dot.

Some bash scripts should be run using the source your-script syntax, e.g., if they contain a change directory (cd) command and the user intends that he be left in that directory after the script is complete.

References

  1. ^ "BASH BUILTIN COMMANDS", the (GNU) Linux man page for "source" in Bash-3.0. 2004 Apr 20
  2. ^ http://en.wikipedia.org/wiki/Dot_(Unix)