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.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!