next up previous contents
Next: PCI Up: Executing Programs Previous: ELF Shared Libraries

Script Files

  Script files are executables which need an interpreter to interpret them. There are a wide variety of interpreters available for Linux; for example wish , and perl . Linux uses the standard Linux convention of having the first line of a script file contain the name of the interpreter. So, a typical script file would start:

#!/usr/bin/wish
The script binary loader tries to find the intepretter for the script.

It does this by attempting to open the executable file that is named in the first line of the script. If it can open it, it has a pointer to its VFS inode and it can go ahead and have it interpret the script file. the name of the script file becomes argument zero (the first argument) and all of the other arguments move up one place (the original first argument becomes the new second argument and so on). Loading the interpretter is done in the same way as Linux loads all of its executable files. Linux tries each binary format in turn until one works. This means that you could in theory stack several interpretters and binary formats making the Linux binary format handler a very flexible piece of software.



David A. Rusling
david.rusling@reo.mts.dec.com