Shell interpreter image activator. An interpreter name beginning at imgp->args->begin_argv is the minimal successful exit requirement.
If the given file is a shell-script, then the first line will start with the two characters ‘#!’ (aka SHELLMAGIC), followed by the name of the shell-interpreter to run, followed by zero or more tokens.
The interpreter is then started up such that it will see: arg[0] -> The name of interpreter as specified after ‘#!’ in the first line of the script. The interpreter name must not be longer than MAXSHELLCMDLEN bytes. arg[1] -> If there are any additional tokens on the first line, then we add a new arg[1], which is a copy of the rest of that line. The copy starts at the first token after the interpreter name. We leave it to the interpreter to parse the tokens in that value. arg[x] -> the full pathname of the script. This will either be arg[2] or arg[1], depending on whether or not tokens were found after the interpreter name. arg[x+1] -> all the arguments that were specified on the original command line.
This processing is described in the execve(2) man page.
Definition at line 102 of file imgact_shell.c.
References exec_args_adjust_args(), sbuf_data(), sbuf_delete(), sbuf_finish(), sbuf_printf(), and SHELLMAGIC.