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?

1 Answer 1


They are synonymous.

From the shell.c file of bash-4.3 source:

long_args[] = {
  { "init-file", Charp, (int *)0x0, &bashrc_file },
  { "rcfile", Charp, (int *)0x0, &bashrc_file },

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:

Added a new '--init-file' invocation argument as a synonym for '--rcfile', per the new GNU coding standards.

  • But then why would it work one way but not the other? Apr 22, 2016 at 19:50
  • @BHustus They should behave in the same way, i have tested couple of times too with various possible factors but they always behave the same way for me..
    – heemayl
    Apr 22, 2016 at 19:52
  • Huh... I'll look back into it. Apr 22, 2016 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.