1
0
Files
irix-657m-src/eoe/cmd/ksh/tests/attributes.sh
2022-09-29 17:59:04 +03:00

74 lines
1.6 KiB
Bash
Executable File

#
# Copyright (c) 1984,1985,1986,1987,1988,1989,1990 AT&T
# All Rights Reserved
#
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T.
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#
function err_exit
{
print -u2 -n "\t"
print -u2 -r $Command: "$@"
let Errors+=1
}
Command=$0
integer Errors=0
r=readonly u=Uppercase l=Lowercase i=22 i8=10 L=abc L5=def Lu5=abcdef xi=20
x=export t=tagged H=hostname LZ5=026 RZ5=026 Z5=123 Rl5=ABcdef R5=def
for option in u l i i8 L L5 LZ5 RZ5 Z5 r x H t R5 Lu5 Rl5 xi
do typeset -$option $option
done
(r=newval) 2> /dev/null && err_exit readonly attribute fails
i=i+5
if ((i != 27))
then err_exit integer attributes fails
fi
if [[ $i8 != 8#12 ]]
then err_exit integer base 8 fails
fi
if [[ $u != UPPERCASE ]]
then err_exit uppercase fails
fi
if [[ $l != lowercase ]]
then err_exit lowercase fails
fi
if [[ t=tagged != $(typeset -t) ]]
then err_exit tagged fails
fi
if [[ t != $(typeset +t) ]]
then err_exit tagged fails
fi
if [[ $Z5 != 00123 ]]
then err_exit zerofill fails
fi
if [[ $RZ5 != 00026 ]]
then err_exit right zerofill fails
fi
L=12345
if [[ $L != 123 ]]
then err_exit leftjust fails
fi
if [[ $L5 != "def " ]]
then err_exit leftjust fails
fi
if [[ $Lu5 != ABCDE ]]
then err_exit leftjust uppercase fails
fi
if [[ $Rl5 != bcdef ]]
then err_exit rightjust fails
fi
if [[ $R5 != " def" ]]
then err_exit rightjust fails
fi
if [[ $($SHELL -c 'echo $x') != export ]]
then err_exit export fails
fi
if [[ $($SHELL -c 'xi=xi+4;echo $xi') != 24 ]]
then err_exit export attributes fails
fi
exit $((Errors))