gpt4 book ai didi

linux - 别名在 Linux 机器上不起作用

转载 作者:太空宇宙 更新时间:2023-11-04 12:27:28 24 4
gpt4 key购买 nike

我在 root 下的 .bash_profile 中创建了一堆别名,但这些别名不起作用。任何人都可以帮助我做错什么

 # .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'

最佳答案

别名的正确位置应该是 .bashrc 而不是 .bash_profile在 .bashrc 中添加别名后,开始新的登录 session 或只运行 .bashrc 文件,即 ./.bashrc

关于linux - 别名在 Linux 机器上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44222823/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com