Commands available in bash -i cannot access bash -l
I don't know how to describe it. This happens when I use vim and set shell=bash -l
. Then I found that a named command mm
that can be executed in the terminal cannot be executed in vim.
And I also found that when I write this command in run.sh
and execute this script. He still reports command not found
. I think there is something wrong with my files $HOME/.bash*
and $HOME/.profile
. And I'm pretty sure they are .profile
almost the same with .bashrc
.
source to share
From $ man bash
:
When invoked as an interactive login shell, or as a non-interactive shell with the --login option, bash first reads and executes commands from the / etc / profile file, if that file exists. After reading this file, it looks for ~ / .bash_profile, ~ / .bash_login and ~ / .profile in that order, and reads and executes commands from the first one that exists and is readable.
and
When an interactive shell that is not a login shell is running, bash reads and executes commands from ~ / .bashrc, if that file exists.
So:
shell | files loaded
--------+-----------------
bash -l | /etc/profile
| ~/.bash_profile
| ~/.bash_login
| ~/.profile
--------+-----------------
bash -i | ~/.bashrc
source to share