fix typo in variable, change from if to case

This commit is contained in:
Jakobus Schürz 2020-03-12 20:48:27 +01:00
parent d69fbd974b
commit 2d6a4a5d05
2 changed files with 12 additions and 4 deletions

View file

@ -11,8 +11,8 @@ if [[ $- = *i* ]] ; then
#echo "interactive shell" >&2
# define variables
[ -z "${MYSHELLCONFIIG_ROOT_TMOUT+x}" ] && MYSHELLCONFIIG_ROOT_TMOUT=500
[ -z "${MYSHELLCONFIIG_USER_TMOUT+x}" ] && MYSHELLCONFIIG_USER_TMOUT=0
[ -z "${MYSHELLCONFIG_ROOT_TMOUT+x}" ] && MYSHELLCONFIG_ROOT_TMOUT=500
[ -z "${MYSHELLCONFIG_USER_TMOUT+x}" ] && MYSHELLCONFIG_USER_TMOUT=0
[ -z "${USERNAME+x}" ] && USERNAME="$USER"
[ -z "${USEREMAIL+x}" ] && USEREMAIL="$USER@$(domainname -f)"
[ -z "${FULLNAME+x}" ] && FULLNAME="$(getent passwd $USER | cut -d ":" -f 5 | cut -d ',' -f 1)"

View file

@ -3,8 +3,16 @@
# if we are root, exit after 5 Minutes
case $(tty) in
/dev/tty[0-9]*)
[ $( id -u ) -eq 0 ] && TMOUT=${MYSHELLCONFIIG_ROOT_TMOUT}
[ $( id -u ) -gt 0 ] && TMOUT=${MYSHELLCONFIIG_USER_TMOUT}
#[ $( id -u ) -eq 0 ] && TMOUT=${MYSHELLCONFIG_ROOT_TMOUT}
#[ $( id -u ) -gt 0 ] && TMOUT=${MYSHELLCONFIG_USER_TMOUT}
case $(id u) in
0)
TMOUT=${MYSHELLCONFIG_ROOT_TMOUT}
;;
*)
TMOUT=${MYSHELLCONFIG_USER_TMOUT}
;;
esac
echo "Run in TTY -> set autologout \$TMOUT=$TMOUT" >&2
;;
*)