#!/bin/bash ## Run a lifelines-report in "batch" mode with cmdline-supplied PROMPT-ANSWERS; by Eugene Reimer 2010-02; ## USAGE: ## llexec REPORTNAME [1st-PROMPTANSWER [2nd-PROMPTANSWER]]... -- any number of args can be be supplied to anticipate all the prompts; ## ## USAGE EXAMPLES: ## llexec related.ll GB "Eugene Louis/Reimer" "Jakob/Harnasveger" ##run related.ll supplying the PROMPT-ANSWERS shown ## llexec related.ll GB I118875 I118894 ##run related.ll identifying persons by KEY ## ## Copyright © 2010 Eugene Reimer; can be modified and/or distributed under the terms of the GPL; see http://www.gnu.org/licenses/gpl.html. cd /pix/er-grandma || exit ##==REVISE AS NEEDED== the directory where output file(s) are to be created DB=/pix/er-grandma/gm423.linesdb ##==REVISE AS NEEDED== the Lifelines-database to be used TMPFILE=/tmp/tmp-llexec-input ##tmpfile used for the PROMPT-ANSWERS ##LLEXEC=/usr/bin/llexec ##the Lifelines llexec executable LLEXEC=$(which -a llexec |grep -v "$0" |head -n1) ##find the Lifelines llexec executable; improved 2010-09-03 REPORT=$1; shift A=; for a in "$@";do A="$A$a\n";done; echo -en "$A" >$TMPFILE ##PROMPT-ANSWERS into tmpfile ## $LLEXEC -r -x$REPORT $DB <$TMPFILE ##run llexec without reporting cputime time $LLEXEC -r -x$REPORT $DB <$TMPFILE ##run llexec with time-command to report cputime exit ===================== NOTES and CHANGE-LOG: ===================== NOTE: you can revise your CONFIG-FILE, ~/.linesrc, for LLPROGRAMS (dirs for report-scripts), for your Date-Format preferences, etc; NOTE: if the finding of llexec doesn't work, just hard-code it as something like: LLEXEC=/usr/bin/llexec DEBUGGING a Lines-program in batch-mode: for syntax-errors you'll get a perfectly good msg, however for undefined function or runtime-errors you'll get endless repetition which must be interupted; however this bug in lifelines-3.0.50 may be fixed in newer versions? 2010-09-03: improved the finding of the Lifelines llexec executable, to be foolproof on any Nix system; was assuming it in a /usr* directory and this script not;