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