Skip to content

Commit

Permalink
Use a login shell when launching screen (#2084)
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdowne authored Mar 7, 2025
1 parent 7d6b7a2 commit 18856f9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ethd
Original file line number Diff line number Diff line change
Expand Up @@ -1545,6 +1545,12 @@ update() {
done <<< "$__old_sessions"
echo
fi
# Screen should run with login shell so that .profile gets loaded and aliases work
if [[ ! -f "${HOME}/.screenrc" ]] || ! grep -q 'shell' "${HOME}/.screenrc"; then
# Intentional, I want this verbatim
# shellcheck disable=SC2016
echo 'shell -$SHELL' >>"${HOME}/.screenrc"
fi
echo "Starting a new screen session with identifier ${__screen_session}"
echo "If you get disconnected, reconnect with \"screen -r ${__screen_session}\""
exec 200<&-
Expand All @@ -1558,7 +1564,7 @@ update() {
#
# exec bash replaces bash -c , so that the user is still inside screen at the end
#
screen -S "${__screen_session}" -dma bash -c "${BASH_SOURCE[0]} update \"\$@\"; exec bash" dummy "$@"
screen -S "${__screen_session}" -dma bash -c "${BASH_SOURCE[0]} update \"\$@\"; exec bash --login" dummy "$@"
screen -RR "${__screen_session}"
exit 0
fi
Expand Down

0 comments on commit 18856f9

Please sign in to comment.