#!/bin/sh # # Yoink # Run this as a filter to process `.in' files. # test -x "functions.sh" && . "functions.sh" test -x "build/functions.sh" && . "build/functions.sh" tmpfile=$(mktemp "tmp-XXXXXXXX") || die "could not create temp file" vars=$(export -p) echo "$vars" | sed -n "s/^export \([A-Za-z0-9_]*\)\{1,\}=[\"']\{0,1\}\([^\"'=]*\)[\"']\{0,1\}$/s=@\1@=\2=g/g p" >"$tmpfile" sed -f "$tmpfile" <"$1" >"$2" rm -f "$tmpfile"