Thread

  1. Re: RPM source files should be in CVS (was Re: [GENERAL] psql -l)

    Thomas Lockhart <lockhart@alumni.caltech.edu> — 2001-07-21T00:31:51Z

    > > On to the next batch....  There are a few perl and python scripts shipped as
    > > examples -- every last one of them shebangs to '/usr/local/perl' or
    > > '/usr/local/python' -- to make them usable, I patch this to '/usr/bin/perl'
    > > or python, as appropriate.
    > Hmm.  Given that they're only examples, and are clearly going to be
    > broken until hand-edited on many systems not only RedHat, it's not clear
    > that this is worth your worrying about.
    
    Ack! There is a way to write this stuff to be portable. The tricks
    change a bit depending on the scripting language you are using, but for
    perl this is how the header should look:
    
    #!/bin/sh
    # -*- perl -*-
    # the line above helps with emacs, and put other comments here...
    
    eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
        & eval 'exec perl -S $0 $argv:q'
        if 0;
    
    # real perl code follows...
    
    
    There is no reason to have a dependency on anything but the location of
    sh, which is much more reliable than locations for perl, tcl, etc etc.
    Not sure the exact form of this technique for python (maybe the same as
    above) but there is a similar but not identical form for tcl code
    (examples available on request; the above for perl is demonstrated in
    contrib/rserv/*.in).
    
                             - Thomas