我是 bash 和 unix 的新手。我正在嘗試為 ls 建立一個別名。在我的 .bash_profile 中,我有以下內容:
alias ls="ls -lhHG"
這根本行不通。如果我把它改成:
alias la="ls -lhHG"
那麼除了 G(顯示漂亮的顏色)之外的所有內容都可以工作。
現在我的 $Path 是
/opt/local/bin:/Users/clang/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
我的 .bash_profile 中唯一的其他內容是
1 export EDITOR=/usr/bin/vim
2 export PATH=/opt/local/bin:~/bin:$PATH
再說一次,我對此完全陌生,所以請對我寬容一點。
答案1
編輯後.bash_profile
,請確保使用以下命令將其來源到當前環境中:
source ~/.bash_profile
或者:
. .bash_profile
然後,您應該可以使用新修改的命令。