summaryrefslogtreecommitdiff
path: root/usr/src/lib/libshell/common/tests/alias.sh
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/libshell/common/tests/alias.sh')
-rw-r--r--usr/src/lib/libshell/common/tests/alias.sh18
1 files changed, 10 insertions, 8 deletions
diff --git a/usr/src/lib/libshell/common/tests/alias.sh b/usr/src/lib/libshell/common/tests/alias.sh
index e001668ef7..f527faf23e 100644
--- a/usr/src/lib/libshell/common/tests/alias.sh
+++ b/usr/src/lib/libshell/common/tests/alias.sh
@@ -1,7 +1,7 @@
########################################################################
# #
# This software is part of the ast package #
-# Copyright (c) 1982-2008 AT&T Intellectual Property #
+# Copyright (c) 1982-2009 AT&T Intellectual Property #
# and is licensed under the #
# Common Public License, Version 1.0 #
# by AT&T Intellectual Property #
@@ -27,6 +27,10 @@ alias err_exit='err_exit $LINENO'
Command=${0##*/}
integer Errors=0
+
+tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; }
+trap "cd /; rm -rf $tmp" EXIT
+
alias foo='print hello'
if [[ $(foo) != hello ]]
then err_exit 'foo, where foo is alias for "print hello" failed'
@@ -66,7 +70,7 @@ alias !!=print
if [[ $(!! hello 2>/dev/null) != hello ]]
then err_exit 'alias for !!=print not working'
fi
-alias foo=echo
+alias foo=echo
if [[ $(print "$(foo bar)" ) != bar ]]
then err_exit 'alias in command substitution not working'
fi
@@ -81,14 +85,12 @@ then [[ ! $(alias -t | grep rm= ) ]] && err_exit 'tracked alias not set'
[[ $(alias -t | grep rm= ) ]] && err_exit 'tracked alias not cleared'
fi
if hash -r 2>/dev/null && [[ ! $(hash) ]]
-then mkdir /tmp/ksh$$ || err_exit "mkdir /tmp/ksh$$ failed"
- trap "cd /; rm -rf /tmp/ksh$$" EXIT
- PATH=/tmp/ksh$$:/bin:/usr/bin
+then PATH=$tmp:/bin:/usr/bin
for i in foo -foo --
- do print ':' > /tmp/ksh$$/$i
- chmod +x /tmp/ksh$$/$i
+ do print ':' > $tmp/$i
+ chmod +x $tmp/$i
hash -r -- $i 2>/dev/null || err_exit "hash -r -- $i failed"
- [[ $(hash) == $i=/tmp/ksh$$/$i ]] || err_exit "hash -r -- $i failed, expected $i=/tmp/ksh$$/$i, got $(hash)"
+ [[ $(hash) == $i=$tmp/$i ]] || err_exit "hash -r -- $i failed, expected $i=$tmp/$i, got $(hash)"
done
else err_exit 'hash -r failed'
fi