bash 脚本如何重写内部命令
# 举例子,修改cd的默认路径
function cd()
{
if [ $# == 0 ]; then
builtin cd ~/work
else
builtin cd $*
fi
}
ref如下,一下博客中 还有其他方法,只是选了其中一个,try and it works
https://www.tutorialkart.com/bash-shell-scripting/bash-override-commands/#:~:text=Bash – Override Commands %3A In this Bash ,have%20to%20create%20a%20function%20with%20name%20ps.

浙公网安备 33010602011771号