Skip to main content

 

Shell parsing is hard.

Yes, shell parsing is non-obvious - it does help enormously to understand that the shell takes what you type on the command line after you hit enter, parses it, replacing variables, expanding globs (wildcards) and other language constructs in the process and only then issues a system call, passing the resulting argv structure to the kernel for execution.

Exhibit A (source of the above quote): How the local shell ssh and the remote shell interact, in unexpected ways

Exhibit B: skarnet's introduction to the execline language design and grammar goes into further details of the argv structure

Exhibit C: How to use execlineb for nginx to wait for up to 10s on the startup of php-fpm, avoiding involvment of a shell process