Unable to unbind a shell function

后端 未结 1 1025
醉话见心
醉话见心 2021-01-27 09:34

This question is based on the thread.

I have the shell function

function man()
{       
    man \"$1\" > /tmp/manual; less /tmp/manual 
}
相关标签:
1条回答
  • 2021-01-27 09:58

    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
    

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

    0 讨论(0)
提交回复
热议问题