Hi,
On 2013-01-18 Ralph Lange wrote:
> A more elegant portable solution is replacing the hashbang with
>
> eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*-
> if 0;
>
> That will find perl in the PATH.
It seems the recommended way to handle this has changed a bit over the years.
The current trend for both Perl and Python seems to be to use /usr/bin/env,
which finds perl in the path without being quite so verbose:
#!/usr/bin/env perl
All modern Unix-type systems understand the #! line and have the env program
in /usr/bin — even Solaris and Cygwin. The magical parts in the above eval
were needed to get around various specific shells that might be executing the
script, but I don't believe anyone will be trying to run EPICS on the exotic
ones nowadays (and they're not needed if the script has a #! line).
Windows does not understand either the #! line or any of the above magic, so
the EPICS build system always explicitly includes $(PERL) in the command line
and I think manually running perl scripts will always require that too.
I propose to change the preamble of all the Perl scripts in base-3.14 to the
above; any objections? There's a patch file of the necessary changes at
http://www.aps.anl.gov/epics/base/R3-14/12-docs/envPerl.patch
- Andrew
--
There is no such thing as a free lunch. When invited for lunch,
it is best to check if you are there to eat, or to be eaten.
-- Clive Robinson
- Replies:
- Re: Alter Perl hashbang in capr.pl J. Lewis Muir
- References:
- Alter Perl hashbang in capr.pl Shankar, Murali
- Re: Alter Perl hashbang in capr.pl Ralph Lange
- Navigate by Date:
- Prev:
Re: Alter Perl hashbang in capr.pl J. Lewis Muir
- Next:
femto and std Pierrick Hanlet
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: Alter Perl hashbang in capr.pl J. Lewis Muir
- Next:
Re: Alter Perl hashbang in capr.pl J. Lewis Muir
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|