aboutsummaryrefslogtreecommitdiffstats
path: root/attach.sh
blob: 055574a63a31a8f406b89e9d4cda29540e15d750 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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)"