[EnglishFrontPage] [TitleIndex] [WordIndex

The Bash Parser

It is imperative that you have a good understanding of how Bash reads your commands in and parses them into executable code. Knowing how Bash works with your code is the key to writing code that works well with Bash.

The following steps are executed for each command that resulted from splitting up the line of data:

After these steps, the next command, or next line is processed. Once the end of the file is reached (end of the script or the interactive bash session is closed) bash stops and returns the exit code of the last command it has executed.

1. Graphical Example

For an more simplified example of the process, see: http://stuff.lhunath.com/parser.png

2. Common Mistakes

These steps might seem like common sense after looking at them closely, but they can often seem counter intuitive for certain specific cases. As an example, let me enumerate a few cases where people have often made mistakes against the way they think bash will interprete their command:


CategoryShell


2012-07-01 04:05