Suppose I have a shell script file foo.sh.
I can do chmod + x foo.sh 
and change it into an executable file. 
In Kernighan-Pike: Unix Programming Environment (UP) they show that after this typing foo should execute the script. Instead in my Ubuntu system I need to type sh foo or ./foo. 
I am guessing this is due to some feature of the shell that wasn't present earlier (when UP was written). I will appreciate if some can enlighten me why this difference exists and why is it important?