ubuntu-users@lists.ubuntu.com
[Top] [All Lists]

Re: Perl problems

Subject: Re: Perl problems
From: Alf-Ivar Holm
Date: Fri, 13 May 2005 13:09:59 +0200
"ZIYAD A. M. AL-BATLY" <zamb@xxxxxxxxxxxx> writes:

>      5. When the others said do "sh secede2.p name.txt", what really
>         happend is that you run/execute the "sh" and pass to it
>         "secede2.pl name.txt" as variables.  

Correct so far.

>      "sh", in turn, will check the first line of "secede2.pl" and
>      see the "#!/usr/bin/perl" and will execute that application and
>      pass to it "name.txt" as variable.  

When sh¹ is started with a file name as argument, it tries to parse
the file as shell commands.  It does _not_ look for magic strings (!#
in this case) in the file, it just try to execute each line, where the
first line will be taken for a comment in sh.

>      This why you don't need "secede2.pl" to be executable in this
>      case, and you don't need to till "sh" it's as "sh", by default,
>      will search *only* in the current directory.

Indeed, the executable bit is not important in this case, but the
command "sh secede2.pl" will most probably fail big time, since Perl
commands are given to a shell interpreter.  "perl secede2.pl" on the
other hand, is the correct way of a non-magic run of the perl program.

        Affi

¹) For Ubuntu, sh is actually a link to bash(1) and not Bourne Shell,
which is what sh usually designates.

--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
http://lists.ubuntu.com/mailman/listinfo/ubuntu-users

<Prev in Thread] Current Thread [Next in Thread>