On Sat, Aug 24, 2019 at 03:30:35PM +0200, 'Kay F. Jahnke' via hugin and other
free panoramic software wrote:
> The 'shebang' is a hint to a shell how to process code which is
> launched by the shell; it's not part of python syntax (seen from the
> python side, it's merely a comment, like the offending api-min and
> api-max tags).
If I remember correctly in the very old days when the shell was asked
to execute say "/bin/which" (which is a #!/bin/sh shell script on my
current system), the kernel would return "not an executable". The
shell would indeed then open the file, check for #! as the first two
characters and then launch the interpreter with the proper argument.
This was in the days that we ran Unix on a PDP-11 with 256k RAM. (I
don't remember if we ran BSD or sysV on that thing.....)
Anyway, on modern systems it is the kernel and not the shell that does
this.
I would vote for keeping the #! as the first two characters.
What comes after that could either be /usr/bin/python, or
/usr/bin/hugin .
In both cases, this should be made to "do the right thing".
If possible, this would mean starting the script within hugin. (I
don't know what kinds of scripts we're talking about, but a script
that asks the user to browse to say a specific type of pictures and
then causes some preprocessing to happen before triggering an
optimization and output step would make this possible. On the other
hand if a script can only be run when you already have images loaded
inside hugin, then this option does not apply. )
The other option for "right thing" would be to print an error message:
"This can only be run from inside hugin". (*)
When executing scripts hugin should try to enforce this first line
to be correct.
Take care that when it makes sense to be able to start scripts on
their own, you should NOT check the PATH part of the
"#!/...path.../program\n" . Just check for the #!/ first three letters
and the right program name at the end of the line.
Roger.
(*)
So the easiest way would be to have:
#!/usr/bin/hugin -s
as the first line of the script. Then the manual page for
hugin would say:
-s <filename>
print "This script must be started from inside hugin" and exit.
--
+-- Rogier Wolff -- www.harddisk-recovery.nl -- 0800 220 20 20 --
- Datarecovery Services Nederland B.V. Delft. KVK: 30160549 -
| Files foetsie, bestanden kwijt, alle data weg?!
| Blijf kalm en neem contact op met Harddisk-recovery.nl!
--
A list of frequently asked questions is available at:
http://wiki.panotools.org/Hugin_FAQ
---
You received this message because you are subscribed to the Google Groups
"hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/hugin-ptx/20190824141914.GH12467%40BitWizard.nl.