I have few questions about the magic number
#!, the shebang.
I read that it was introduced by Dennis Ritchie in the 70s as a way to see a script as an executable file.
I don't understand, why it was introduced. What brought him to introduce it? What did he like?
The second thing I don't understand is: why do I need to declare the script as an executable? I mean why do I have to do
chmod +x myscript?
I think in the following way, once I put the string
#! myinterpter then when I will make
./myscript the OS will take this file, it will see that it contains the shebang and then it will call the appropriate interpreter. So why do I need to use
chmod +x? Why does the OS (unix, linux) need me to make my script executable?