配置Mac/Linux终端启动执行脚本
查看当前系统终端使用的脚本
在macOS终端中,您可以通过执行以下命令来查看当前使用的shell类型:
echo $SHELL
这条命令会输出当前用户默认使用的shell路径,例如 <font style="color:rgb(51, 51, 51);background-color:rgb(237, 238, 240);">/bin/bash</font>
或 <font style="color:rgb(51, 51, 51);background-color:rgb(237, 238, 240);">/bin/zsh</font>
。如果您想查看当前运行的shell,可以使用以下命令:
ps -p $$
这将显示当前shell进程的信息,包括使用的shell路径。
配置终端启动执行脚本
如果系统是mac,默认的终端脚本都是zsh。因此需要在home目录下配置**.zshrc**文件
export JAVA_HOME=$(/usr/libexec/java_home -v 21)alias cdmysql='cd $MYSQL_HOME'
alias ll='ls -l'
如果系统是Linux,默认的终端脚本都是bash。因此需要在home目录下配置**.bashrc**文件
# .bashrc# Source global definitions
if [ -f /etc/bashrc ]; then. /etc/bashrc
fi# User specific environment
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
export PATH# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=# User specific aliases and functions