zoid
12-24-2004, 10:34 PM
Can somebody tell me what this for Unix script typical header actually means to the system? How and by whom is it interpreted?
#![path-to-executable]
#![path-to-executable]
![]() | View Full Version : Script Header zoid 12-24-2004, 10:34 PM Can somebody tell me what this for Unix script typical header actually means to the system? How and by whom is it interpreted? #![path-to-executable] BMurtagh 12-25-2004, 01:40 AM here's an example to help ya: #!/bin/bash This indicates that the script should be run in the bash shell regardless of which interactive shell the user has chosen. This is very important, since the syntax of different shells can vary greatly. zoid 12-25-2004, 01:37 PM Well, who is interpreting this line? Who is calling this binary? Where is it exactly defined that the first line of a text file can contain a path to an executable? Where is it defined how the content of the file is passed to this executable? Thanks. seeperhost 12-26-2004, 12:51 AM When accessing the file through the web server, almost all of the time, the interpreter is determined by the extension. For example, if you have a text file named test.cgi, it will attempt to parse it as an actual CGI script. But it is still important to have the first line the interpreter. zoid 12-26-2004, 01:04 AM Thanks, but this doesnt exactly answer my question. I wasnt talking about webservers which usually have file extension associations similar to Windows but I was asking about the general scripting mechanism on Unix. WHO is actually reading this first line? zoid 12-26-2004, 01:52 PM Nobody...? |