tilde.sh revision da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968
########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1982-2007 AT&T Knowledge Ventures #
# and is licensed under the #
# Common Public License, Version 1.0 #
# by AT&T Knowledge Ventures #
# #
# A copy of the License is available at #
# (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) #
# #
# Information and Software Systems Research #
# AT&T Research #
# Florham Park NJ #
# #
# David Korn <dgk@research.att.com> #
# #
########################################################################
function err_exit
{
print -u2 -n "\t"
let Errors+=1
}
alias err_exit='err_exit $LINENO'
function home # id
{
set -o noglob
print -r -- "$6"
else print .
fi
}
integer Errors=0
if [[ ~ != $HOME ]]
fi
x=~
if [[ $x != $HOME ]]
fi
x=x:~
if [[ $x != x:$HOME ]]
fi
if [[ ~+ != $PWD ]]
fi
x=~+
if [[ $x != $PWD ]]
fi
if [[ ~- != $OLDPWD ]]
fi
x=~-
if [[ $x != $OLDPWD ]]
fi
do h=$(home $u)
if [[ $h != . ]]
x=~$u
[[ $x -ef $h ]] || "x=~$u not $h"
break
fi
done
x=~%%
if [[ $x != '~%%' ]]
fi
x=~:~
fi
HOME=/
[[ ~ == / ]] || err_exit '~ should be /'