"Fossies" - the Fresh Open Source Software Archive

Member "passwd_exp-1.2.11/install-trans-sh" (10 Sep 2005, 660 Bytes) of package /linux/privat/old/passwd_exp-1.2.11.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #! /bin/sh
    2 # Quite simple sed-2-sed expresions transformation script
    3 # WARNING: might be very very buggy
    4 #
    5 
    6 
    7 #progs
    8 SED=`which sed`
    9 
   10 #arguments
   11 CONF=$1
   12 shift
   13 
   14 if test "${CONF}x" = "x";
   15     then b=`basename $0`;
   16          echo "usage: $b trans-map-file [SED OPTIONS] files" >&2;
   17          exit 1;
   18 fi
   19 
   20 #transform simple var mapping to sed lang
   21 (
   22 
   23 ${SED}  "${CONF}"                       \
   24     -e 's!:!@:!'                        \
   25     -e 's!#.*$!!'                       \
   26     -e '/^./ { s!^!s:@!g; s!$!:g!g; }'
   27 
   28 #test transformation correctness
   29 if test "$?" != "0";
   30     then echo "ERROR: error occured while transforming sed rules !!!" >&2;
   31          exit 1;
   32 fi;
   33 ) | (
   34 #post it to sed and transform input files
   35     ${SED} -f - $@
   36     #cat
   37 )
   38 
   39 #EOF