[tt]$ echo )
bash: syntax error near unexpected token `)'[/tt]
That's a syntax error. The shell caught it.
[tt]$ cat --i-stink some-file
cat: unrecognized option `--i-stink'
Try `cat --help' for more information.[/tt]
That might be what you'd call a semantic error. The shell doesn't know what options [tt]cat[/tt] will accept, so it just passes them on. Then, when [tt]cat[/tt] sees those options and doesn't know what to do with them, it issues the error.
Now, the shell doesn't normally "send the commands to the kernel." If you run a command called [tt]cat[/tt], the shell just looks for an executable named "cat" in its PATH variable, then spawns a new process based on that executable.
If it's making a system call, like chdir (like from the [tt]cd[/tt] command, then the commands it uses are shell builtins, which means their code to evaluate arguments and perform their function is a part of the shell.
In that case, a part of the shell does do the semantic check, but only because it "is" the command, in a sense.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.