diff options
author | David Phillips <david@sighup.nz> | 2017-09-17 21:45:24 +1200 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2017-09-17 21:45:24 +1200 |
commit | cb887a3bb28d483a145e4e77642b4b497a208772 (patch) | |
tree | cd000736550f3128712de5ee1dd7a1a894982a5e | |
parent | f486bb096e6a405822d4a02718012fb395270d13 (diff) | |
download | initscripts-cb887a3bb28d483a145e4e77642b4b497a208772.tar.xz |
Add script to macro-ify hardcoded values/paths
-rwxr-xr-x | replace.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/replace.sh b/replace.sh new file mode 100755 index 0000000..5bde2bd --- /dev/null +++ b/replace.sh @@ -0,0 +1,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} |