tmux: check if session is interactive
This commit is contained in:
parent
4900f4aaa4
commit
561a0647be
1 changed files with 9 additions and 6 deletions
|
@ -12,6 +12,8 @@ source "${HOME}/dotfiles/.bash_ps1"
|
||||||
# add my scripts to PATH
|
# add my scripts to PATH
|
||||||
PATH=$PATH:"${HOME}/dotfiles/scripts"
|
PATH=$PATH:"${HOME}/dotfiles/scripts"
|
||||||
|
|
||||||
|
## check interactive shell https://unix.stackexchange.com/questions/26676/how-to-check-if-a-shell-is-login-interactive-batch
|
||||||
|
if [[ $- == *i* ]] ; then
|
||||||
### tmux auto attach
|
### tmux auto attach
|
||||||
# Check if the user ID is not 0 (root)
|
# Check if the user ID is not 0 (root)
|
||||||
if [ "$EUID" -ne 0 ]; then
|
if [ "$EUID" -ne 0 ]; then
|
||||||
|
@ -20,6 +22,7 @@ if [ "$EUID" -ne 0 ]; then
|
||||||
tmux attach -t default || tmux new -s default
|
tmux attach -t default || tmux new -s default
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
### keychain
|
### keychain
|
||||||
eval "$(keychain -q --eval --timeout 60 --agents ssh,gpg)"
|
eval "$(keychain -q --eval --timeout 60 --agents ssh,gpg)"
|
||||||
|
|
Loading…
Reference in a new issue