vincent at cunniffe.net
Wed Nov 7 11:49:14 GMT 2001
James.Chambers at irishlife.ie wrote:
> if I create a text file in notepad on windows, is it possible to make it
> executable on linux, I tried chmod +x and changing the owner of the file. No
> matter what I did it wouldn't execute for me.
Well, a valid executable isn't just one which is 'chmod u+x'... it must
also have a valid piece of 'magic' at the start to indicate to the kernel
that it is in fact an executable file, and must then contain valid data
which is understandable to the executing environment.
The output from a compiler would have this automatically, but you have to
add your own when writing things such as text scriptfiles.
The following is a valid script :
echo "Hello world!"
The 'magic' is the first two characters, #!, followed by a valid interpreter
which will be handed the file to execute. You can have anything here,
including a unix shell, a PHP parser, a java engine, or whatever.
More information about the ILUG