[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is it normal for `bash -s foo` not to make 1=foo available from ~/.b
From: |
Torka Noda |
Subject: |
Re: Is it normal for `bash -s foo` not to make 1=foo available from ~/.bashrc? |
Date: |
Mon, 27 Mar 2017 14:32:14 +0200 |
On Sat, 25 Mar 2017 15:33:47 -0400
Chet Ramey <chet.ramey@case.edu> wrote:
> >
> > Is it normal for Bash positional parameters not to be
> > available from ~/.bashrc during initialization?
>
> Yes. Bash has always worked like this. The startup files are
> read before the positional parameters are assigned.
>
For any particular reason?
Why are they not all made available anyway? with an alternative
array for the arguments sent to the commands fed to Bash stdin
with "-s", so we don't have to handle all possible arguments if
we just want the non-option arguments.
There definitely are other relatively clean ways (`env` and
'--rcfile', most notably), but using `bash -s foo bar` and
handling the positional parameters from ~/.bashrc, would be the
cleanest for small per-shell customizations (although it sure is
not what '-s' is meant to be used for).
Examples of people trying stuffs related to this:
"Open gnome terminal programmatically and execute commands
after bashrc was executed":
https://superuser.com/questions/198015
"Open gnome terminal programmatically and execute commands
after bashrc was executed":
http://stackoverflow.com/questions/3896882
"Custom environment with gnome-terminal":
http://askubuntu.com/questions/600139
"Opening multiple tabs with gnome-terminal":
http://askubuntu.com/questions/277543
- Is it normal for `bash -s foo` not to make PS1=foo available from ~/.bashrc?, Torka Noda, 2017/03/25
- Re: Is it normal for `bash -s foo` not to make 1=foo available from ~/.bashrc?, Torka Noda, 2017/03/25
- Re: Is it normal for `bash -s foo` not to make PS1=foo available from ~/.bashrc?, Chet Ramey, 2017/03/25
- Re: Is it normal for `bash -s foo` not to make 1=foo available from ~/.bashrc?,
Torka Noda <=
- Re: Is it normal for `bash -s foo` not to make 1=foo available from ~/.bashrc?, Chet Ramey, 2017/03/28
- Re: Is it normal for `bash -s foo` not to make 1=foo available from ~/.bashrc?, Torka Noda, 2017/03/28
- Re: Is it normal for `bash -s foo` not to make 1=foo available from ~/.bashrc?, Chet Ramey, 2017/03/28
- Re: Is it normal for `bash -s foo` not to make 1=foo available from ~/.bashrc?, Torka Noda, 2017/03/29
- Re: Is it normal for `bash -s foo` not to make 1=foo available from ~/.bashrc?, Greg Wooledge, 2017/03/29
- Re: Is it normal for `bash -s foo` not to make 1=foo available from ~/.bashrc?, Torka Noda, 2017/03/29