|Bash Prompt HOWTO: $Revision: 0.100 $, $Date: 2009/08/07 02:33:22 $|
|Prev||Chapter 3. Bash Programming and Shell Scripts||Next|
When a file is sourced (by typing either source filename or . filename (that's a period, ".") at the command line), the lines of code in the file are executed as if they were printed at the command line. This is particularly useful with complex prompts, to allow them to be stored in files and called up by sourcing the file they are in.
In examples, you'll find that I often include #!/bin/bash at the beginning of files including functions. This is not necessary if you are sourcing a file, just as it isn't necessary to chmod +x a file that is going to be sourced. I do this because it makes Vim (my editor of choice, no flames please - you use what you like) think I'm editing a shell script and turn on colour syntax highlighting.