chaintool-doc

Chaintool documentation
Info | Log | Files | Refs | README | LICENSE

bash-templater (276B)


      1 #!/bin/bash
      2 
      3 rules="$1"
      4 source "$rules"
      5 
      6 mapfile -t keywords < <(< "$1" sed -n 's/^\([A-Za-z0-9_]\+\)=.*$/\1/p')
      7 
      8 while read -r line
      9 do
     10   for keyword in "${keywords[@]}"
     11   do
     12     line=$(sed "s@\@${keyword}\@@${!keyword}@g" <<<"$line")
     13   done 
     14   echo "$line"
     15 done < /dev/stdin