爲了搞定字符終端交互處理的一些編程問題,決定分析一下shell的代碼。
找了一個BASH的代碼。
來源:http://tiswww.case.edu/php/chet/bash/bashtop.html
BASH:The GNU Bourne-Again SHell
The current version of bash is bash-4.2. (GPG signature).
從上述鏈接下載到一個bash-4.2.tar.gz,解壓縮後,建立Source Insight工程。
shell.c中的main函數,函數最後兩行:
reader_loop ();
exit_shell (last_command_exit_value);
}
看起來就是我要深入分析的入口了。