\input texinfo @c -*-texinfo-*- @c %**start of header @setfilename exec-as.info @settitle exec-as @afourpaper @documentencoding UTF-8 @documentlanguage en @finalout @c %**end of header @dircategory Miscellaneous @direntry * exec-as: (exec-as). exec with explicit argv[0] @end direntry @copying Copyright @copyright{} 2015 Mattias Andrée @quotation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. @end quotation @end copying @ifnottex @node Top @top exec-as -- exec with explicit argv[0] @insertcopying @end ifnottex @titlepage @title exec-as @subtitle exec with explicit @code{argv[0]} @author by Mattias Andrée (maandree) @page @vskip 0pt plus 1filll @insertcopying @page @end titlepage @contents @menu * Overview:: Brief overview of @command{exec-as}. * Invoking:: Executing @command{exec-as}. * GNU Free Documentation License:: Copying and sharing this manual. @end menu @node Overview @chapter Overview @command{exec-as} shall spawn a program and lets the user specify a value for @code{argv[0]} explicitly. @command{exec-as} is intended as a shell command. It makes no since to use it from most programming languages. Since this is not a builtin function, it cannot be used as @command{exec} without arguments to set file descriptors. Because this is not a builtin function, running @command{exec-as} would normally do an fork–exec rather than just an exec. To just perform an exec, you need to use @command{exec} too: @code{exec exec-as} @node Invoking @chapter Invoking At least one argument are required. The first argument is the file to run. This can either be an absolute path, an explicitly relative path, or a file in @env{$PATH}. The second argument is the name of the process, @code{argv[0]}. The following arguments are the rest in of the values in @code{argv}, often called the command line arguments. @command{'exec-as bash -bash'} will run the first program in @env{$PATH} named @command{bash}, and set @code{argv[0]} to @code{-bash} (making it a login shell.) You can add addition argument as needed. @node GNU Free Documentation License @appendix GNU Free Documentation License @include fdl.texinfo @bye