Re: '!#' script interpreter convention ...
From: John DuBois (spcecdt_at_deeptht.armory.com)
Date: 04/29/03
- Next message: William Park: "Re: Bash help"
- Previous message: William Park: "Re: Shell Script"
- In reply to: Saurabh Verma: "'!#' script interpreter convention ..."
- Next in thread: Saurabh Verma: "Re: '!#' script interpreter convention ..."
- Reply: Saurabh Verma: "Re: '!#' script interpreter convention ..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: 29 Apr 2003 00:26:08 GMT
In article <58c50fc8.0304281616.538e31ee@posting.google.com>,
Saurabh Verma <saurabh_verma78@yahoo.com> wrote:
>I am writing a perl script(say 'test.pl'), with
>first line as '#!perl', but when i am running command 'test.pl' on
>command line, getting the following error:
>test.pl: Command not found.
>I am using tcsh shell, on solaris platform.
>whereas running 'perl test.pl' is woking.
>Or, if i replace the first line with '#!/usr/local/bin/perl', then
>also its woking.
>So, do i need to give the full path of the executable on the first
>line??
Yes.
>Till now, i had the understanding that '#!interpreter args' in the
>first line of a script will lead the shell to run command 'interpreter
>args script-file', that in my case is 'perl test.pl'(which is working
>fine, when i am running it from command line).
>
>Can somebody tell me, how exactly '#!' is handled by a shell in
>general and by tcsh in this specific case.
It isn't handled by the shell, it's handled by the kernel. The shell at most
looks at the #! line and notes that this isn't a program that it should handle
by forking and interpreting itself. After making that determination, it exec's
the program, and it is the kernel that interprets the #! line.
John
-- John DuBois spcecdt@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/
- Next message: William Park: "Re: Bash help"
- Previous message: William Park: "Re: Shell Script"
- In reply to: Saurabh Verma: "'!#' script interpreter convention ..."
- Next in thread: Saurabh Verma: "Re: '!#' script interpreter convention ..."
- Reply: Saurabh Verma: "Re: '!#' script interpreter convention ..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|