diff options
Diffstat (limited to 'attach.sh')
| -rwxr-xr-x | attach.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/attach.sh b/attach.sh new file mode 100755 index 0000000..055574a --- /dev/null +++ b/attach.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ -z "$TAKETTY_PTY" ]; then + echo "Error: TAKETTY_PTY not set" >&2 + return 1 2>/dev/null || exit 1 +fi + +if [ ! -e "$TAKETTY_PTY" ]; then + echo "Error: $TAKETTY_PTY does not exist" >&2 + return 1 2>/dev/null || exit 1 +fi + +exec 0<>"$TAKETTY_PTY" +exec 1>&0 +exec 2>&0 + +echo "Attached to $TAKETTY_PTY (note: not controlling terminal without attach helper)" |
