[mythtv-users] mythlink.pl

Mike Hodson mystica at gmail.com
Sun Jun 10 17:00:27 UTC 2018


On Sun, Jun 10, 2018, 10:38 Bill Meek <keemllib at gmail.com> wrote:

> On 06/10/2018 10:46 AM, Klaus Becker wrote:
> > I have
> >
> > #!/bin/sh
> > /usr/bin/perl
> > /home/klaus/mythlink.pl --link
> /home/klaus/multimedia/video/tv/aufnahmen
> >
> > It starts, but nothing happens and the script will not end.
> >
> > Both scripts are in /home/klaus
> >
> > Klaus
>
> Remove /usr/bin/perl from the script. It appears to hang because perl is
> waiting for input from the terminal.
>
> --
> Bill
>

Hi Bill, and Klaus,

The problem you are seeing here is actually an effect of how the email from
Greg was formatted, which led to a wrong copy and paste.  While it's
correct that Perl was hanging for input from the terminal, this just
elaborates a little more as to why, and perhaps gives more information on
how to avoid such an issue in the future.

There was only supposed to be 1 actual command line, starting with
/usr/bin/perl and then only a single space separating this from /home/klaus/
mythlink.pl .  Instead, the visual formatting of the email led to
/usr/bin/perl being left alone on its own line.

Namely the intent was to put the full path to the Perl interpreter
executable in the script to avoid ambiguity, and then naming the full path
to the script in your home directory as perl's command line argument: the
to-be-interpreted script.

This way, you would not have to make mythlink.pl executable to be able to
'./mythlink.pl' or modify its shebang line or any other way of getting it
going.  Even if you have made the script executable, it's usually good
practice to put the full binary of the script interpreter, in this case
Perl, into a command line that is to be run by an automated process without
the user shell and environment information loaded.

If for example, your preferred Perl interpreter is a different version from
the (often ancient) system version, if maybe you needed a newer Perl
interpreter for whatever purpose, putting the full path to this binary into
your script would therefore be required. It's usually just good practice to
do this with scripting.

In short, what you're seeing here is an error caused by the minutiae of cut
and paste, and the numerous ways that Unix and thereby in similarity,
Linux, allows you to make the same thing happen - in this case, running the
mythlink script.


#!/bin/sh
'somehow execute the mythlink script with its own --link dirname argument'

Where 'somehow' above depends on a number of things such as your current
directory, binary search path, environment, executable mode set on the
script, and so on.

Hope this helps

Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20180610/6fb3d9ad/attachment.html>


More information about the mythtv-users mailing list