无法解除绑定外壳功能 [英] Unable to unbind a shell function

查看:67
本文介绍了无法解除绑定外壳功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题基于线程

我有shell函数

function man()
{       
    man "$1" > /tmp/manual; less /tmp/manual 
}

问题是存在命令员.

如何用我的命令替换命令?

推荐答案

将人"$ 1"替换为路径名:/usr/bin/man.或将其更改为在反引号中使用哪个男人".然后在当前shell中运行脚本.在bash/ksh上,您需要将脚本保存在某个文件中,说出man.sh,然后将其运行为'. ./man.sh'.

Replace man "$1" with the pathname: /usr/bin/man. Or change it to use 'which man' within backquotes. Then run your script in the current shell. On bash/ksh you need to save your script in some file, say man.sh and then run it as '. ./man.sh'.

cat > man.sh
function man()
{       
    /usr/bin/man "$1" > /tmp/manual; less /tmp/manual 
}
^D

. ./man.sh

您明白了.您可以随时取消定义功能:unset -f man

You get the idea. You can undefine the function at any time: unset -f man

这篇关于无法解除绑定外壳功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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