Artur Zaprzala <artur.zaprzala@talex.com.pl> wrote:
> When I run as root the following command (change "me" to existing user):
> su -c echo me -- --norc
> I get the message:
> bash: /root/.bashrc: Permission denied
> This shows that bash tries to read ~/.bashrc inspite of --norc option
The "--norc" argument is not recognized as an option because is
appears after the "-c" script. See the bash man page, near the top
under "OPTIONS":
-c string If the -c option is present, then commands are
read from string. If there are arguments after
the string, they are assigned to the positional
parameters, starting with $0.
$ bash -c 'echo ":$-:"; echo ":$0:"' -e
:hBc:
:-e:
$ bash -e -c 'echo ":$-:"; echo ":$0:"'
:ehBc:
:bash:
paul