aboutsummaryrefslogtreecommitdiffstats
path: root/attach.sh
diff options
context:
space:
mode:
authorLouis Burda <dev@sinitax.com>2026-01-30 22:49:06 +0100
committerLouis Burda <dev@sinitax.com>2026-01-30 22:51:59 +0100
commit0ff1fafa09eb0af827233d3e0906cf64282d096f (patch)
tree3729dbad9023c155115d408a779a5b0210a6e4f9 /attach.sh
downloadtaketty-master.tar.gz
taketty-master.zip
Add initial versionHEADmastermain
Diffstat (limited to 'attach.sh')
-rwxr-xr-xattach.sh17
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)"