########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1982-2011 AT&T Intellectual Property #
# and is licensed under the #
# Common Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# 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> #
# #
########################################################################
#
# bash compatibility startup script
#
# Author:
# Karsten Fleischer
# Omnium Software Engineering
# An der Luisenburg 7
# D-51379 Leverkusen
# Germany
#
# <K.Fleischer@omnium.de>
#
alias declare=typeset
integer SHLVL
export SHLVL
SHLVL+=1
if [[ ! $EUID ]]
readonly EUID
fi
if [[ ! $UID ]]
readonly UID
fi
readonly SHELLOPTS
IFS=:
for i in $SHELLOPTS
do
[[ -n "$i" ]] && set -o $i
done
unset IFS
fi
function SHELLOPTS.get
{
}
function GROUPS.set
{
return 1
}
function GROUPS.unset
{
unset -f GROUPS.set
unset -f GROUPS.unset
}
typeset -A DIRSTACK
function DIRSTACK.get
{
set -A .sh.value $(dirs)
}
function DIRSTACK.set
{
integer index
}
function DIRSTACK.unset
{
unset -f DIRSTACK.get
unset -f DIRSTACK.set
unset -f DIRSTACK.unset
}
function PS1.set
{
while [[ $remaining ]]
remaining=${remaining#$prefix}
var+="$prefix"
case ${remaining:1:1} in
t) var+="\$(printf '%(%H:%M:%S)T')";;
d) var+="\$(printf '%(%a %b:%e)T')";;
n) var+=$'\n';;
s) var+=ksh;;
w) var+="\$(pwd)";;
W) var+="\$(basename \"\$(pwd)\")";;
u) var+=$USER;;
h) var+=$(hostname -s);;
'#') var+=!;;
!) var+=!;;
then var+='#'
else var+='$'
fi;;
'\') var+='\\';;
'['|']') ;;
[0-7]) case ${remaining:1:3} in
[0-7][0-7][0-7])
k=4;;
[0-7][0-7])
k=3;;
*) k=2;;
esac
eval n="\$'"${remaining:0:k}"'"
var+=$n
remaining=${remaining:k}
continue
;;
"") ;;
*) var+='\'${remaining:0:2};;
esac
done
}
function logout
{
if shopt -q login_shell; then
exit
else
print ${BASH##*/}: $0: not login shell: use 'exit' >&2
return 1
fi
}
PS1="bash$ "
function source
{
unset OPATH
if shopt -q sourcepath; then
else
PATH=.
fi
fi
. "$@"
}
unalias .
alias .=source
alias enable=builtin
function help
{
function has_help_option
{
[[ $1 == @(''|/*|:|echo|false|true|login|test|'[') ]] && return 1
return 0
}
typeset -A short_use=(
[echo]='Usage: echo [ options ] [arg]...'
[:]='Usage: : ...'
[true]='Usage: true ...'
[false]='Usage: false ...'
[login]='Usage: login [-p] [name]'
['[']='Usage: [ EXPRESSION ] | [ OPTION'
[test]='Usage: test EXPRESSION | test'
)
b=$(builtin)
if (( $# == 0))
then print 'The following is the current list of built-in commands:'
print -r $'Type help *name* for more information about name\n'
do if has_help_option $cmd
print -r -- "${usage:7}"
fi
done
return
fi
b=${b/'['/}
for try_cmd
do if has_help_option $try_cmd
fi
fi
done
}
function cd
{
local msg
local args
local i
local a
local ret
if ! shopt -q cdable_vars; then
command cd "$@"
else
ret=$?
if [[ $ret != 0 ]]; then
for i
do
case $i in
*) eval a="$"$i
fi
;;
esac
done
command cd $args
else
print -- $msg
return $ret
fi
fi
}
typeset BASH=$0
nameref BASH_SUBSHELL=.sh.subshell