Re: '!#' script interpreter convention ...
From: Saurabh Verma (saurabh_verma78_at_yahoo.com)
Date: 04/29/03
- Next message: William Park: "Re: bash Shell behaving weird"
- Previous message: Solaris Boy: "Re: cannot su to root"
- In reply to: John DuBois: "Re: '!#' script interpreter convention ..."
- Next in thread: Kevin Collins: "Re: '!#' script interpreter convention ..."
- Reply: Kevin Collins: "Re: '!#' script interpreter convention ..."
- Reply: Wartan Hachaturow: "Re: '!#' script interpreter convention ..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: 29 Apr 2003 11:48:19 -0700
Thanks John.
Do, you know of any good way to run a this kind of script on different
machines with different perl paths. With me, the issue is, on some
machines perl is in 'usr/local/bin' and on some other its in 'usr/bin'
so, my script fails on one of these. And the way i am using it, i
can't run 'perl test.pl', as i need to run 'test.pl' only(as
executable).
Thanks,
Saurabh
spcecdt@deeptht.armory.com (John DuBois) wrote in message news:<3eadc6a0$0$79553$8eec23a@newsreader.tycho.net>...
> 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
- Next message: William Park: "Re: bash Shell behaving weird"
- Previous message: Solaris Boy: "Re: cannot su to root"
- In reply to: John DuBois: "Re: '!#' script interpreter convention ..."
- Next in thread: Kevin Collins: "Re: '!#' script interpreter convention ..."
- Reply: Kevin Collins: "Re: '!#' script interpreter convention ..."
- Reply: Wartan Hachaturow: "Re: '!#' script interpreter convention ..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|