On 1/6/18 8:14 AM, Nat! wrote: > I tried to come up with a workaround, but I couldn't find any. > > Basically what I do: > > env -i bash --norc --noprofile > > > This gives me an interactive shell, with a very clean environment (even no > PATH), that does not contain system specify "surprises". > This works. > > But what I really want is to set up a custom environment before going > interactive. > > env -i bash --norc --noprofile --rcfile custom.sh > > This doesn't work, because --norc (IMO) incorrectly preempts the --rcfile > use, where's the point ?
It's not incorrect; --norc is intended to suppress execution of the interactive shell startup files, even if you specify another file to not execute. You could use $ENV, but that's only effective for shells started in Posix mode. > > The command > > env -i bash --noprofile --rcfile x.sh > > does work to my satisfactions on systems, that do not enable SYS_BASHRC (OS > X). > > So if --rcfile was a feature earlier than SYS_BASHRC (2.05), it's a bona > fide regression. It's not a regression. The sole intent of SYS_BASHRC was to allow system administrators who wanted a file sourced before the user's interactive shell startup file (e.g., to make sure that some environment variables were set) to specify one. It's not intended to be overridden, and it's executed under the same circumstances as the user's bashrc file. (SYS_BASHRC was inserted in August, 1995 and made its first public appearance in bash-2.0. Discussion started a few months prior.) -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/