1

I have ~/.bashrc, ~/.bash_profile, ~/.profile and similar files under system directories.

How can I run bash without running the initialization/configuration scripts

  • under ~?
  • under system directories?
  • under both above?

Requirements

  • don't change the files.

  • run bash as a login or nonlogin shell (interested in both). I still allow running those files when starting Linux.

  • run bash as a interactive or noninteractive shell (interested in both)

Thanks.

0

1 Answer 1

7
bash --noprofile

runs a Bash shell without loading any of the config scripts (both user and system-wide).

From man bash:

   -i        If the -i option is present, the shell is interactive.
   -l        Make bash act as if it had been invoked as a login shell (see INVOCATION below).

(...)

   --noprofile
          Do  not  read  either  the  system-wide  startup  file  /etc/profile  or  any  of  the  personal initialization files ~/.bash_profile,
          ~/.bash_login, or ~/.profile.  By default, bash reads these files when it is invoked as a login shell (see INVOCATION below).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .