I want to remove echo
command (which is located in /bin/echo
), but the command echo still work as normal. When I use which
command, it confirm that echo
was removed
/usr/bin/which: no echo in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
Do you know what's happening
Echo is a bash builtin command, which is what you're seeing.
I guess the real question is: why do you want to do this? There are many, many programs that rely on echo, all of which will break if you disable this command.
bash is also a builtin from your shell (e.g bash, ksh etc.) so even if you remove the original echo binary, it will still work from your shell (but you will not have the arguments etc. available like with the binary)
see the bash builtins here : http://www.gnu.org/software/bash/manual/html_node/Bash-Builtins.html
try to add this in the user .bash_profile (or from the shell) :
and try to run echo again (ref : https://astoryworthtelling.wordpress.com/2011/03/20/disable-bash-builtin-commands/) and it shouldn't work
This is actually a great demonstration of why it's a bad idea to use echo in scripts that you want to be portable. It's often overridden by shell built ins.
Have a look at
And search for echo to find where the built in version is defined.
Depending on your need, you can still override echo with an alias