when called without mode argument now, the script returns the status of attach
This commit is contained in:
parent
920a568521
commit
5d98199bf9
17
session
17
session
|
|
@ -171,15 +171,20 @@ print_scrollback() {
|
|||
}
|
||||
|
||||
## Parse first argument (= mode argument)
|
||||
if [[ "$#" -lt 1 ]]; then
|
||||
print_help
|
||||
exit $EXIT_INVALID_MODE
|
||||
fi
|
||||
mode=$1
|
||||
shift
|
||||
|
||||
## Now enter mode specific code
|
||||
case $mode in
|
||||
"")
|
||||
if [ -z "$DTACH_SESSION_NAME" ];then
|
||||
echo "Currently not attached."
|
||||
exit $EXIT_NOT_ATTACHED
|
||||
else
|
||||
echo "Currently attached to '$DTACH_SESSION_NAME'."
|
||||
exit $EXIT_SUCCESS
|
||||
fi
|
||||
;;
|
||||
"attach"|"att"|"a")
|
||||
exit_if_in_session
|
||||
# If no session name specified: select interactively
|
||||
|
|
@ -204,7 +209,7 @@ case $mode in
|
|||
session_path=$(get_session_path $session_name)
|
||||
CMD="dtach -a $session_path -e ${config[detach_char]} -r winch "
|
||||
#echo $CMD
|
||||
echo "[attached to $session_name]"
|
||||
echo "[attached to '$session_name']"
|
||||
[[ "${config[log_session]}" == "yes" ]] && print_scrollback $session_name
|
||||
eval $CMD
|
||||
exit $EXITSUCCESS
|
||||
|
|
@ -231,7 +236,7 @@ case $mode in
|
|||
CMD+="/bin/bash"
|
||||
fi
|
||||
#echo $CMD
|
||||
echo "[new session $session_name]"
|
||||
echo "[new session '$session_name']"
|
||||
eval $CMD
|
||||
exit $EXITSUCCESS
|
||||
;;
|
||||
|
|
|
|||
Loading…
Reference in New Issue