summaryrefslogtreecommitdiff
path: root/.local/bin
diff options
context:
space:
mode:
authorsinanmohd <sinan@firemail.cc>2023-07-07 13:16:49 +0530
committernazu <nazu@Nazers-MacBook-Pro.local>2023-07-08 10:59:27 +0400
commite59de522665556711026f61ff3bebe2e260f528a (patch)
treef35bbe63fe57a4b9497741f28eab3b1069295cde /.local/bin
parent83664cc0c39b66e32ce3904e095b6dbc1f3550d7 (diff)
ttyasrt: initial commit, make sure a tty is connected
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/ttyasrt18
1 files changed, 18 insertions, 0 deletions
diff --git a/.local/bin/ttyasrt b/.local/bin/ttyasrt
new file mode 100755
index 0000000..21b5d42
--- /dev/null
+++ b/.local/bin/ttyasrt
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+die()
+{
+ printf "\033[31;1merr: %b\033[0m\n" "$1"
+ command -v notify-send > /dev/null &&
+ notify-send " ttyasrt" "$1"
+ exit "${2:-1}"
+}
+
+[ -z "$TERMINAL" ] &&
+ die "\$TERMIANL must be set"
+
+if tty --silent; then
+ "$@"
+else
+ "$TERMINAL" -- "$@"
+fi