Question

This question is based on the thread.

I have the shell function

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

The problem is there exists the command man.

How can you replace the command with my command?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top