Replace 'if (command -v x &>/dev/null); then' with 'if command -v x &>/dev/null; then' across completion.d, rc.d and profile.d. Parentheses forced a subshell fork for every 'if' check, which is unnecessary overhead since command -v runs fine in the current shell. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
20 lines
678 B
Plaintext
20 lines
678 B
Plaintext
# GNU Screen stuff
|
|
if command -v tmux &>/dev/null; then
|
|
if [ "$(pgrep -u "${UID}" "tmux" | wc -l)" -gt 0 ]; then
|
|
if [[ ${TERM} != screen* ]]; then
|
|
nb_sessions=$(tmux list-session | wc -l)
|
|
nb_sessions_attached=$(tmux list-session | grep -c "attached")
|
|
nb_sessions_detached=$(tmux list-session | grep -c -v "attached")
|
|
|
|
echo_info "tmux : found ${nb_sessions} session(s)"
|
|
|
|
echo "➤ ${nb_sessions_attached} session(s) attached"
|
|
tmux list-sessions | grep "attached" | sed -e 's/^/ • /'
|
|
|
|
echo "➤ ${nb_sessions_detached} session(s) detached"
|
|
tmux list-sessions | grep -v "attached" | sed -e 's/^/ • /'
|
|
|
|
fi
|
|
fi
|
|
fi
|