Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021 
<== Date ==> <== Thread ==>

Subject: Perl scripts: eval exec instead of shebang - why?
From: "Konrad, Martin" <konrad@frib.msu.edu>
To: "core-talk@aps.anl.gov" <core-talk@aps.anl.gov>
Date: Mon, 10 Sep 2018 20:24:04 +0000
Hi,
Looking at the Perl scripts included in EPICS Base I'm wondering if it
is really necessary to start some of them (see for example [1]) with the
rather esoteric

eval 'exec perl -S $0 ${1+"$@"}'  # -*- Mode: perl -*-
    if $running_under_some_shell;

rather than the usual "#!/usr/bin/perl" or "#!/usr/bin/env perl" (please
refer to [2] for an explanation of the existing "eval exec" solution).
According to my understanding all Unix systems should understand the
shebang. Windows doesn't care (it looks at the file name extension). Can
the experts for non-Unix systems shine some light on why this is needed?

Thanks,

Martin

P.S.: I ran into this in the context of packaging for Debian where an
automatic quality check was complaining about the missing shebang.

[1]
https://git.launchpad.net/epics-base/tree/src/std/softIoc/makeInstallDir.pl?h=3.16
[2]
https://zeyuanhu.wordpress.com/2016/07/19/understanding-shebang-eval-combo-from-ancient-perl-script/

-- 
Martin Konrad
High Performance Controls Team Leader
Facility for Rare Isotope Beams
Michigan State University
640 South Shaw Lane
East Lansing, MI 48824-1321, USA
Tel. 517-908-7253
Email: konrad@frib.msu.edu

Replies:
Re: Perl scripts: eval exec instead of shebang - why? Andrew Johnson

Navigate by Date:
Prev: Jenkins build is back to normal : epics-base-3.15 #379 APS Jenkins
Next: Re: Perl scripts: eval exec instead of shebang - why? Andrew Johnson
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021 
Navigate by Thread:
Prev: Jenkins build is back to normal : epics-base-3.15 #379 APS Jenkins
Next: Re: Perl scripts: eval exec instead of shebang - why? Andrew Johnson
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021 
ANJ, 10 Sep 2018 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·