If I define a music function to apply an arbitrary system command to a
file thusly,

sysinc =
#(define-music-function (p l cmd fname) (string? string?)
   "Run system command, cmd, and redirect output to fname.
    then include fname in input."
    (system (string-concatenate (list cmd " > " fname)))
    #{ \include $fname #})

and use it to preprocess an input file ,

\sysinc "cat junk.txt | sed 's/4/8/g'"  "junk.inc"

it works as expected, BUT, I have to run LilyPond twice for changes in
the original file to show up in the lilypond output.  Is there anyway
around this limitation?

Note: what I'm actually trying to do with the preprocessing, as
opposed to the trivial example above,  is something that cannot be
done easily with a music function.  I know about the --evaluate
command line option but that's also not practical for what I'm trying
to do.

Thanks,
Mike

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to