1 2 3 4 5 6 7 8 9
#!/bin/sh PREFIX=$1 RELPATH= while [ $PREFIX != / ] do RELPATH=../$RELPATH PREFIX=`dirname $PREFIX` done exec sed s#@RELPATH@#${RELPATH}# <$2 >$3