[Lazarus] Raspbian FPC 3.3.1 and Lazarus 2.0 Available

Anthony Walter sysrpl at gmail.com
Tue Feb 19 18:47:03 CET 2019


Bo,

A shebang is important because it tells Unix like systems which interpreter
to when a script is run. You might have written a script an executed it
using "sh" rather than "bash". For example you might have been running your
script as follows:

sh myscript.sh

The problem you create when doing this is that sh and bash are not the
same. They have dialects with different rules, and if you use sh to run
your script when other people get your script they have no way of knowing
which interpreter you are using and the script may fail for them.

The solution is to include a shebang, or #!/path/to/interpreter, as the
first line of you script. This allows people to run your script by changing
it to an executable and running it directly rather than specifying the
interpreter.

So if your script was writer to be used with sh, you would make the first
line:

#!/bin/sh

And then people would run your script using the following code to mark it
executable:

chmod +x myscript.sh
./myscript.sh

Then whenever you script is executed it will be run through sh, which would
be what you designed the script to use. And by the way, I used sh as an
example in this message. I have no idea what interpreter you used when
writing your script. You know which one it was, so put that interpreter in
the first line.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20190219/3a379574/attachment-0001.html>


More information about the lazarus mailing list