Next: , Previous: guile-tools doc-snarf, Up: Miscellaneous Tools


13.13 guile-tools edit-script-header

See Executable Modules, for related discussion.

Usage: edit-script-header [OPTIONS] FILE ...

Grok and modify each FILE's header (hash-bang invocation sequence)
according to OPTIONS:

 -o, --output OTHER  -- write to file OTHER instead of modifying FILE
 -g, --guile [GUILE] -- use GUILE as the interpreter
 -G, --GUILE-guile   -- use ${GUILE-guile} construct, implies -e
 -n, --no-act        -- do not do the edit, display parse results only
 -v, --verbose       -- display progress reports
 -b, --backup EXT    -- rename output file to fooEXT before writing
 -s, --style STYLE   -- convert output to use header STYLE (see below)
 -i, --installed     -- use installed guile as the interpreter

By default, the name of the interpreter is constructed by combining
bindir (use "guile-tools guile-config info bindir" to see this value)
with the name "guile", for example: "/usr/local/bin/guile".  This name
is placed directly after the hash-bang "#!" on the first line followed
by a space and then the meta switch "\".  The second line has the rest
of the args, terminating with "-s" and a newline.  The third line has
a bang-hash "!#" only.  This is the `direct-with-meta-switch' style.

Simple edits (like changing the guile interpreter from /usr/bin/guile
to /usr/local/bin/guile, for example) are no problem.  Converting
between styles is somewhat more tricky.  Here is a list of the styles
that are recognized and supported (for -s option):

* old-style-sh-wrapper

  This is primarily for executable modules, and looks something like:

  #!/bin/sh
  main='(module-ref (resolve-module '\''MODULE-NAME) '\'main')'
  exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@"
  !#

  We call it "old" because there are now better ways to invoke `main'
  (see `modern-sh-wrapper').  Converting scripts from and to this style
  requires accompanying changes to the script's invocation convention
  that `edit-script-header' does not handle.

* modern-sh-wrapper

  This style looks something like:

  #!/bin/sh
  exec ${GUILE-guile} -e ENTRY-POINT -s $0 "$@"
  !#

  The distinguishing characteristic is `exec' and `-s $0 "$@"'.  The
  `-e ENTRY-POINT' is optional.  This style is fully convertable to
  and from the `direct-with-meta-switch' style.

* direct-with-meta-switch

  This style looks something like:

  #!/usr/local/bin/guile \
  -e ENTRY-POINT -s
  !#

  The distinguishing characteristic is the guile interpreter named in
  the first line as well as the meta switch.  The `-e ENTRY-POINT' is
  optional.  This style is fully convertable to and from the
  `modern-sh-wrapper' style.

* direct-with-minus-s

  This style looks something like:

  #!/usr/local/bin/guile -s
  !#

  The distinguishing characteristic is the guile interpreter named
  in the first line as well as the `-s' switch.  This style can be
  converted to and from the other ones with some restrictions.