bash shell command line parser (navel gazing)
by SoftSprocket from LinuxQuestions.org on (#5B9FS)
I'm thinking about how and what happens when bash parses its commndline.
For example:
Code:$ numbers=( 1 2 3 4 5 ); for i in "${numbers[@]}"; do /bin/echo $i; done | egrep "2|3|4" 2>/dev/nullThe left side of the pipe would be recognized as the bash scripting language by the parser. Does it parse it in the instance that is running in the terminal? Execute a new instance?
In either case it must fork 5 sequential processes and pipe their standard output to another process running egrep and standard error to a process writing to /dev/null.
Am I right in thinking that there will be a minimum of 7 processes forked to execute this?


For example:
Code:$ numbers=( 1 2 3 4 5 ); for i in "${numbers[@]}"; do /bin/echo $i; done | egrep "2|3|4" 2>/dev/nullThe left side of the pipe would be recognized as the bash scripting language by the parser. Does it parse it in the instance that is running in the terminal? Execute a new instance?
In either case it must fork 5 sequential processes and pipe their standard output to another process running egrep and standard error to a process writing to /dev/null.
Am I right in thinking that there will be a minimum of 7 processes forked to execute this?