-
Notifications
You must be signed in to change notification settings - Fork 0
Home
sarahmss edited this page Dec 21, 2021
·
7 revisions
As soon as you launch the terminal, you are prompted with commands. If you're on Linux this prompt may take the form of some text followed by a dollar sign which waits for commands to be executed.
Before all this happens, the shell needs some information.
- it is handled with an interactive user or a script (cmd_line)
- Interpret the context with which it's running (env)
- Iteration of an infinite loop (repl)
- Sanitize the user’s command (Tokenizer)
- Parse commands and set command table (Parse)
- Checks if this command is an alias
- If it is an alias, substitute for the command it is aliased to.
- Compare this command to the names of commands that are built into the shell.
- Check if our command is a relative path (in this case, the command will begin with a period
.) - Search in its environment for the PATH variable. This environment variable contains paths of the directories that the shell must search, looking for files that match the command.