哦,我知道了,你不能改profile。
你看你的.bash_profile文件,对shell的 aliases脚本的定义:
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
指明了要想 aliases ,必须参考~/.bashrc里面的东西。
所以,你可以将
alias hahahaha="ls -a" 这样的定义放在~/.bashrc里。这样,当前用户输入hahahaha就能ls -a。
全局用户的改法你住一看你当前用户的~/.bashrc里对默认脚本的定义:
# .bashrc
# User specific aliases and functions
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
alias hahahaha="ls -a"
他是先考虑/etc/bashrc脚本,然后在考虑你后加的命令。
所以,修改全局用户的alias,要修改/etc/bashrc脚本,而不是profile,profile是shell的默认配置。