0
我已经在根目录中创建一堆别名在.bash_profile中上,但那些不working.can任何人能帮助我在做什么错别名不工作的Linux机器
# .bash_profile
#shopt -s expand_aliases
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export JAVA_HOME=/opt/app/java
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export PATH
#Alias
alias jfiles="cd /opt/app/Projects"
alias jscripts='cd /opt/app/Config'
alias jmres='cd /opt/app/tomcat/jmresources'
alias llrt='ll -r -t'
你有没有'source'创建后,你的'.bash_profile'你别名?或者开始一个新的终端? – Evert
'.bashrc',而不是'.bash_profile',适用于别名。后者只针对登录shell运行,前者针对每个交互式shell运行(当然,如果你有'.bashrc'采购它,就像这里一样)。而且,是的,编辑后需要重新编译'.bashrc'才能立即生效。 –
为了方便起见,您可以创建一个单独的'.aliases'文件,并在'.bash_profile'中读取它,类似于读取'.bashrc'文件的几行。 – Evert