source: branches/help/GDEHELP/genhelp.sh

Last change on this file was 10646, checked in by westram, 11 years ago
  • remove write permission for generated help-files
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 709 bytes
Line 
1#!/bin/bash
2
3if [ -z "$4" ] ; then
4    echo "Usage: genhelp.sh outputfile title header inputtext"
5    echo "       Generates help pre-source 'outputfile' from 'inputtext'"
6    exit 1
7fi
8
9OUTPUTFILE=$1
10TITLE=$2
11HEADER=$3
12INPUTTEXT=$4
13SED=${ARBHOME}/SH/arb_sed
14
15if [ \! -f $HEADER ]; then
16    echo "Header '$HEADER' not found"
17    exit 1
18fi
19if [ \! -f $INPUTTEXT ]; then
20    echo "Input '$INPUTTEXT' not found"
21    exit 1
22fi
23
24write_help() {
25    echo "$TITLE"
26    echo ""
27    echo "# Do not edit!!! Generated from ../$INPUTTEXT"
28    echo ""
29    cat $HEADER
30    $SED -e 's/^/    /' < $INPUTTEXT
31}
32
33test -f $OUTPUTFILE && chmod u+w $OUTPUTFILE
34write_help > $OUTPUTFILE
35test -f $OUTPUTFILE && chmod a-w $OUTPUTFILE
Note: See TracBrowser for help on using the repository browser.