I've been working with bash, and I came across the --rcfile
and --init-file
options. Bash's man page lists these under the same section, but they seem to behave differently. Take the following scenario:
I have created a ~/.bash_profile
which has the following command:
exec env -i <variables> /bin/bash <option> ~/.bashrc
for the purposes of a project which require the terminal to open with a specific configuration; it is instructed not to read /etc/bash.bashrc
and instead only read from ~/.bashrc
. If <option>
is –init-file, ~/.bashrc
is read without error. However, --rcfile
in its place does not appear to source the file.
What is the difference between these two seemingly identical commands?
Best Answer
They are synonymous.
From the
shell.c
file ofbash
-4.3 source:As you can see they are defined the same way and also works the same way.
The parameter
bashrc_file
stores the filename.For further assurance, the
CHANGES
file in the source contains: