This commit is contained in:
Jakobus Schürz 2023-01-11 16:55:44 +01:00
commit 45bea66688

View file

@ -50,10 +50,47 @@ function cpb() {
function sudo() {
local SUDO
local BASH
local C
# SUDO=$( if [ -e /bin/sudo ]; then echo /bin/sudo; else echo /usr/bin/sudo; fi )
SUDO=$(which sudo)
[ getbashrcfile ] && BASH="bash --rcfile $(getbashrcfile)" || unset BASH
if $SSHS ; then
logdebug "TEMPCONFIG"
logdebug "\$1: $1"
[ -e "$(which $1 2>/dev/null)" ] && C="x"
logdebug "C: $C"
[ getbashrcfile ] && BASH="bash --rcfile $(getbashrcfile) ${C:+-c}" || unset BASH
logdebug "BASH1: $BASH"
[ -z "${C:-x}" ] && unset BASH
logdebug "BASH2: $BASH"
else
logdebug "NO Tempconfig"
unset BASH
fi
logdebug "SUDO: $SUDO"
logdebug "BASH3: $BASH"
logdebug "SHLVL: $SHLVL"
logdebug "@: $@"
[ -z "${C:-x}" ] && logwarn "run $1 -> $(which $1)"
logdebug $SUDO \
GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
GIT_COMMITTER_EMAIL="$GIT_COMMITTER_EMAIL" \
GIT_COMMITTER_NAME="$GIT_COMMITTER_NAME" \
TMUX="$TMUX" \
SSHS="$SSHS" \
P11M="$P11M" \
SSH_TTY="$SSH_TTY" \
SSH_AUTH_SOCK="$SSH_AUTH_SOCK" \
http_proxy="$http_proxy" \
$BASH \
$@
$SUDO \
GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
@ -66,7 +103,7 @@ function sudo() {
SSH_AUTH_SOCK="$SSH_AUTH_SOCK" \
http_proxy="$http_proxy" \
$BASH \
"$@"
$@
}
@ -579,12 +616,22 @@ catbashrcfile () {
loginfo "bash uses default"
return 1
else
#cat $(cat /proc/$$/cmdline | xargs -0 echo|awk '{print $3}')
cat $(getbashrcfile)
fi
EXIT
}
vibashrcfile () {
ENTRY
if [ -z ${BASHRC+x} ] ; then
loginfo "bash uses default"
return 1
else
vi $(getbashrcfile)
fi
EXIT
}
getvimrcfile () {
ENTRY
if [ -z ${VIMRC+x} ] ; then
@ -606,6 +653,15 @@ catvimrcfile () {
EXIT
}
vivimrcfile () {
ENTRY
if [ -z ${VIMRC+x} ] ; then
echo "vim uses default" >&2
else
vi $(getvimrcfile)
fi
EXIT
}
# Functions to set the correct title of the terminal
function title()