I created a file with
echo "/bin/sh" > cp
Made it an executable and updated the $PATH variable to consider the current folder first.
chmod +x cp export PATH=.:$PATH
The program cp is overloaded over the default command. And I got a shell anytime i ran the cp command.
But when I try to recreate the same results with the echo command. It fails to overload. I can't figure out the reason for such a behaviour. reference image
I've tried renaming the cp program as the echo command. And it still failed to produce the same results.