Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15527

Re: behaviour of bash with "--login" + "--rcfile" depends on position of argument

From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: behaviour of bash with "--login" + "--rcfile" depends on position of argument
Date 2019-10-21 09:43 -0400
Message-ID <mailman.1381.1571665462.9715.bug-bash@gnu.org> (permalink)
References <1DB406F67241344CB6F3A199E54EF09D25BC525F@MBX2010-K01.ad.fz-juelich.de> <20191021134346.GH28751@eeg.ccf.org>

Show all headers | View raw


On Mon, Oct 21, 2019 at 09:19:48AM +0000, "Göbbert, Jens Henrik" wrote:
> Description:
>         "bash --rcfile --login test.sh" will run test.sh but "bash --login --rcfile test.sh" will not, even though this would be expected from the help/man pages.

--rcfile takes an argument.  It has to be followed by the name of the
rc file that you want bash to read.

When you write   --rcfile --login   you're telling bash that its rc file
is named "--login", and that it should read this file, instead of ~/.bashrc,
if it needs to read an rc file.

However, since you also gave the name of a script to execute, bash doesn't
need to read an rc file.  So, it simply ignores the   --rcfile --login
that you gave it, and just executes test.sh.

On the other hand, when you write   --login --rcfile test.sh
you are telling bash that its rc file is named "test.sh", and that it
should read this instead of ~/.bashrc if it needs to read an rc file.

But since you're using the   --login   argument, bash doesn't need to
read an rc file.  So, it doesn't make use of the   --rcfile test.sh
arguments.  You're basically just running   bash --login   .

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: behaviour of bash with "--login" + "--rcfile" depends on position of argument Greg Wooledge <wooledg@eeg.ccf.org> - 2019-10-21 09:43 -0400

csiph-web