1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/bin/bash if [ -z $1 ] ; then echo missing argument: file to read exit 1 fi file="$1" sedargs="" for var in \ BINDIR \ OPENRC_RUN \ ; do sedargs="${sedargs} -e s:\@${var}\@:${!var}:g " done cat "$file" | sed ${sedargs}