Since it overwrites my history when used in multiple terminals, I want to turn off the functionality fc -W
. Unfortunately I have a habit of typing it often.
I think it's not possible to make an alias, since there is a whitespace in fc -W
.
So I tried making a function, something like this:
# Make sure to never invoke fc -W
fc(){
for x; do
if [[ "${x}" == -W ]]; then
echo "I'm sorry Dave. I'm afraid I can't do that."
return
fi
done
fc "${@}"
}
However, now the call fc "${@}"
calls itself, and I get infinite recursion. Typically I would avoid this by using e.g. /usr/bin/fc
, instead of fc
, however:
$ type fc
> fc is a shell builtin
How can I avoid the infinite recursion in this case? Or is there a better way to disable one flag of a command?