不要在多个bash脚本中显示推送/弹出堆栈(安静的推送/弹出) [英] Don't display pushd/popd stack across several bash scripts (quiet pushd/popd)

查看:60
本文介绍了不要在多个bash脚本中显示推送/弹出堆栈(安静的推送/弹出)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次使用push或popd时,它会将堆栈打印到标准输出.怎么不这样做?

Each time I use pushd or popd, it print the stack to standard output. How not to do so?

我不想每次都执行pushd > /dev/null,因为我有很多互相调用的脚本.

I don't want to do pushd > /dev/null each time because I have a lot of scripts calling each other.

也许可以做一个很好的覆盖,但是我只需要在脚本中覆盖这些内置函数,然后恢复正确的行为即可.

Maybe a nice override will do it, but I'll need to override these builtins only in my scripts, and then restore the correct behavior.

推荐答案

您可以添加

pushd () {
    command pushd "$@" > /dev/null
}

popd () {
    command popd "$@" > /dev/null
}

在每个脚本的顶部.这可能是解决您的问题所需的最低工作量.

to the top of each script. This is probably the minimum amount of work it will take to solve your problem.

这篇关于不要在多个bash脚本中显示推送/弹出堆栈(安静的推送/弹出)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆