如果不是bash 而是 csh的話,請參考 [1] 的說明修改 ~/.cshrc 以下針對 BASH
這次想要自動加載alias
alias vi='vim'
alias ll='ls -l'
alias ll='ls -l'
但是無論設定在哪都不成功,下面是我設定的位置
/etc/bash.bashrc
~/.bashrc
/etc/profile.d/root.sh
最後才知道要設定在家目錄的這個檔案
vi ~/.bash_profile
全域的設定
/usr/local/etc/profile
上面的檔案原本不存在,自己新增
因為 [1] 給了建議用 strings 這個指令來看設定檔:
$ strings $(which bash)| grep profile
/usr/local/etc/profile
noprofile
~/.profile
~/.bash_profile
上面的指令strings很奇怪,我還沒搞懂
不過[1]提供一個方了,就是在 /.bash_profile 裡面上加一行讓他能讀取目錄下的 .bashrc
[ -r $HOME/.bashrc ] && . $HOME/.bashrc
查看自己的shell
echo $SHELL
參考資料
https://forums.freebsd.org/threads/how-to-save-what-was-written-to-alias.75806/