开发者

How do I call internal function in bash if I have defined with the same name?

开发者 https://www.devze.com 2022-12-27 17:50 出处:网络
I want to overload the functionality of cd in bash so that I can do the following checks: if the directory is not in DIRSTACK开发者_运维技巧 -> pushd dir

I want to overload the functionality of cd in bash so that I can do the following checks:

if the directory is not in DIRSTACK开发者_运维技巧 -> pushd dir

else cd dir (or cd ~#)

However now I get a recursive loop when trying to cd

The reason for this is that I am trying to work around the fact that bash does not support set dunique


Use the builtin called "builtin":

cd () {
    builtin cd "$@"
}


See also here for various attempts to workaround this.

0

精彩评论

暂无评论...
验证码 换一张
取 消