From a2d31375b30ad06fd7e58482de9ac940e5d7fe3b Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Mon, 6 May 2024 23:16:31 +0200 Subject: [PATCH] dataport: bash: combine tmux-auto-attach and keychain into one function --- .bash_extra | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.bash_extra b/.bash_extra index 5ea5608..a5c4033 100644 --- a/.bash_extra +++ b/.bash_extra @@ -12,19 +12,27 @@ source "${HOME}/dotfiles/.bash_ps1" # add my scripts to PATH PATH=$PATH:"${HOME}/dotfiles/scripts" -### tmux auto attach -# Check if the user ID is not 0 (root) -if [ "$EUID" -ne 0 ]; then - # then auto attach +## check interactive shell https://unix.stackexchange.com/questions/26676/how-to-check-if-a-shell-is-login-interactive-batch +if [[ $- == *i* ]] ; then + ### git-bash + if [ "$HOSTNAME" = lzeorpt001 ]; then + source /usr/share/git-core/contrib/completion/git-prompt.sh + fi + ### root alias + alias root='sudo -H -u root /usr/bin/sudo2uls' + ### tmux auto attach if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then tmux attach -t default || tmux new -s default fi + ### keychain + if [ "$HOSTNAME" = lzeorpt001 ]; then + export GPG_TTY=$(tty) + fi + if [ "$(hostname -s)" == "lzeorpt001" ] || [ "$(hostname -s)" == "lbdlspa001" ]; then + eval $(keychain -q --eval --timeout 60 --agents ssh,gpg) + fi fi -### keychain -eval "$(keychain -q --eval --timeout 60 --agents ssh,gpg)" -export GPG_TTY=$(tty) - ### Praktische Dinge # Deaktiviere FlowControl # https://unix.stackexchange.com/questions/332791/how-to-permanently-disable-ctrl-s-in-terminal