diff options
Diffstat (limited to 'examples/misc/aliasconv.bash')
-rwxr-xr-x | examples/misc/aliasconv.bash | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/misc/aliasconv.bash b/examples/misc/aliasconv.bash index 2245f06..22a0447 100755 --- a/examples/misc/aliasconv.bash +++ b/examples/misc/aliasconv.bash @@ -7,11 +7,13 @@ # Chet Ramey # chet@po.cwru.edu # -trap 'rm -f /tmp/cb$$.?' 0 1 2 3 6 15 +trap 'rm -f $TMPFILE' 0 1 2 3 6 15 + +TMPFILE=$(mktemp -t cb.XXXXXX) || exit 1 T=$'\t' -cat << \EOF >/tmp/cb$$.1 +cat << \EOF >$TMPFILE mkalias () { case $2 in @@ -31,9 +33,9 @@ EOF # since they whole thing is going to be surrounded by single quotes when # passed to mkalias -sed -e "s:':\\'\\\'\\':" -e "s/^\([a-zA-Z0-9_-]*\)$T\(.*\)$/mkalias \1 '\2'/" >>/tmp/cb$$.1 +sed -e "s:':\\'\\\'\\':" -e "s/^\([a-zA-Z0-9_-]*\)$T\(.*\)$/mkalias \1 '\2'/" >>$TMPFILE -$BASH /tmp/cb$$.1 | sed -e 's/\$cwd/\$PWD/g' \ +$BASH $TMPFILE | sed -e 's/\$cwd/\$PWD/g' \ -e 's/\$term/\$TERM/g' \ -e 's/\$home/\$HOME/g' \ -e 's/\$user/\$USER/g' \ |