* Bang Executing Perl Scripts
@ 2011-01-24 20:41 zzapper
2011-01-24 21:11 ` Guillaume Brunerie
0 siblings, 1 reply; 5+ messages in thread
From: zzapper @ 2011-01-24 20:41 UTC (permalink / raw)
To: zsh-users
Hi
Until now I've been writing zsh wrappers for my perl scripts:-
I've got
alias -s pl=perl
So I can execute a script just by typing its name
> /usr/local/bin/info.pl
But I want to execute it from anywhere , but it doesn't seem to notice perl
scripts even if they are in my $path or $fpath
I can however do:-
>=info.pl
Is there a better way
And finally I'd really like to execute it just with
>info
--
zzapper
http://zzapper.co.uk/ Technical Tips
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bang Executing Perl Scripts
2011-01-24 20:41 Bang Executing Perl Scripts zzapper
@ 2011-01-24 21:11 ` Guillaume Brunerie
2011-01-24 21:52 ` zzapper
2011-01-24 22:14 ` François Revol
0 siblings, 2 replies; 5+ messages in thread
From: Guillaume Brunerie @ 2011-01-24 21:11 UTC (permalink / raw)
To: zzapper; +Cc: zsh-users
[-- Attachment #1: Type: text/plain, Size: 568 bytes --]
2011/1/24 zzapper <david@tvis.co.uk>
> Hi
> Until now I've been writing zsh wrappers for my perl scripts:-
>
> I've got
> alias -s pl=perl
> So I can execute a script just by typing its name
>
> > /usr/local/bin/info.pl
>
> But I want to execute it from anywhere , but it doesn't seem to notice perl
> scripts even if they are in my $path or $fpath
>
> I can however do:-
>
> >=info.pl
>
> Is there a better way
>
> And finally I'd really like to execute it just with
>
> >info
Hi,
Why not putting #!/usr/bin/perl as the first line of your perl scripts?
Guillaume
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bang Executing Perl Scripts
2011-01-24 21:11 ` Guillaume Brunerie
@ 2011-01-24 21:52 ` zzapper
2011-01-24 22:14 ` François Revol
1 sibling, 0 replies; 5+ messages in thread
From: zzapper @ 2011-01-24 21:52 UTC (permalink / raw)
To: zsh-users
Guillaume Brunerie wrote in
news:AANLkTimSXtDjkw2DhfxTHWYPSBPpnwnbjPueC0RS-9qJ@mail.gmail.com:
>
>
> Hi,
> Why not putting #!/usr/bin/perl as the first line of your perl scripts?
>
> Guillaume
>
It is already.
BTW I've found that I can do
>=info
Which is pretty much good enough for me!
( and also my script isn't actually named info I just chose that as an
example, a bad example as of course info already exists as a man reader )
--
zzapper
http://zzapper.co.uk/ Technical Tips
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bang Executing Perl Scripts
2011-01-24 21:11 ` Guillaume Brunerie
2011-01-24 21:52 ` zzapper
@ 2011-01-24 22:14 ` François Revol
2011-01-24 22:38 ` Corwin Zechar
1 sibling, 1 reply; 5+ messages in thread
From: François Revol @ 2011-01-24 22:14 UTC (permalink / raw)
To: Guillaume Brunerie; +Cc: zzapper, zsh-users
Le 24 janv. 2011 à 22:11, Guillaume Brunerie a écrit :
> 2011/1/24 zzapper <david@tvis.co.uk>
>
>> Hi
>> Until now I've been writing zsh wrappers for my perl scripts:-
>>
>> I've got
>> alias -s pl=perl
>> So I can execute a script just by typing its name
>>
>>> /usr/local/bin/info.pl
>>>
>
>
> Hi,
> Why not putting #!/usr/bin/perl as the first line of your perl scripts?
This is not portable.
BeOS and Haiku do not have /usr for ex, so perl is elsewhere.
(and so is env, so using #!/usr/bin/env perl is just moving the problem around)
François.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bang Executing Perl Scripts
2011-01-24 22:14 ` François Revol
@ 2011-01-24 22:38 ` Corwin Zechar
0 siblings, 0 replies; 5+ messages in thread
From: Corwin Zechar @ 2011-01-24 22:38 UTC (permalink / raw)
To: François Revol; +Cc: Guillaume Brunerie, zzapper, zsh-users
Perhaps a better solution is to leave the shebang (#!/usr/bin/perl) out
of your Perl scripts; ensure that perl appears in your path and run your
scripts via:
% perl myscript.pl
Be sure to add execute privs to each Perl script.
Further, you could create a zsh function to prepend each Perl script
with "perl " so that you only need type:
% myscript.pl
CZ
On 1/24/11 2:14 PM, François Revol wrote:
> Le 24 janv. 2011 à 22:11, Guillaume Brunerie a écrit :
>
>> 2011/1/24 zzapper<david@tvis.co.uk>
>>
>>> Hi
>>> Until now I've been writing zsh wrappers for my perl scripts:-
>>>
>>> I've got
>>> alias -s pl=perl
>>> So I can execute a script just by typing its name
>>>
>>>> /usr/local/bin/info.pl
>>>>
>>
>> Hi,
>> Why not putting #!/usr/bin/perl as the first line of your perl scripts?
> This is not portable.
> BeOS and Haiku do not have /usr for ex, so perl is elsewhere.
> (and so is env, so using #!/usr/bin/env perl is just moving the problem around)
>
> François.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-01-24 22:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-24 20:41 Bang Executing Perl Scripts zzapper
2011-01-24 21:11 ` Guillaume Brunerie
2011-01-24 21:52 ` zzapper
2011-01-24 22:14 ` François Revol
2011-01-24 22:38 ` Corwin Zechar
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).