What happens when you type ls *.c ?

How does the shell interpret the command just passed ?
- It will split the command in 2 tokens, ls and *.c
- It will expand the variables, here *.c . the use of * variable means the shell will look for filenames with the pattern “name ending by .c in current directory”
- Then it substitutes this pattern by what it finds, in the example: file.c
- The shell moves on to ls, it first looks if ls is an alias, and if it is it loops until it finds what ls really stands for.
- Assuming ls just meant use ls program, the the shell looks if it is a shell built-in.
- It is not, so the shell follows the directory listed in the PATH variable. This variable lists all the directories containing the executables on the computer.
- It should find ls in /usr/bin. Then it executes it. Since there are no options, it will lists what the second token is feeding it. In the example file.c.
- The shell will prompt us for another command. In order to do that it will use the PS1 variable which defines what the prompt should look like.
END.