2015/12/23 23:20 "Mark J. Reed" <[email protected]>: > > You can also use the `env` program to make a script that doesn't rely on the > specific location of gforth in the file system: > > #!/usr/bin/env gforth
Just a reminder that convenience and security are often at odds with each other. You generally want to consider the odds that someone might be able to slip a compromised gforth into your path ahead of the real one before you take the path out of the shebang line. > That uses up your one extra argument, so you lose the ability to pass > additional flags on the command line, but it makes your script more portable > (on my system, for instance, gforth is in /usr/local/bin, so a > #!/usr/bin/gforth line won't work). > (And that's basically the real reason for that bothersome make install step, when making generalized tools. :) > On Wed, Dec 23, 2015 at 6:20 AM, Anton Ertl > <[email protected]> wrote: >> >> On Tue, Dec 22, 2015 at 07:50:49PM -0500, James Gere wrote: >> > I think I read somewhere that some shells/implementations require a comment >> > character in the shebang. Gforth Manual I'm certain. >> >> "#!" starts a comment (until the end of the line) in Gforth, and >> that's there in order to allow Gforth scripts. This means that you >> have to put a space after #! (allegedly there is at least one Unix >> variant that checks for "#! /", so the space is a good idea anyway). >> >> For a .fs script, no additional flags are necessary. If you call >> >> bla.fs arg1 arg2 >> >> and bla.fs starts with >> >> #! /usr/bin/gforth >> >> this is equivalent >> >> /usr/bin/gforth bla.fs arg1 arg2 >> >> which is probably what you want. You can put *one* additional >> argument (e.g., a flag) on the #! line; e.g., if you have the >> following in bla.fs: >> >> #! /usr/bin/gforth --die-on-signal >> >> then the call abive is equivalent to >> >> /usr/bin/gforth --die-on-signal bla.fs arg1 arg2 >> >> - anton >> > > > > -- > Mark J. Reed <[email protected]>
