From e59de522665556711026f61ff3bebe2e260f528a Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Fri, 7 Jul 2023 13:16:49 +0530 Subject: ttyasrt: initial commit, make sure a tty is connected --- .local/bin/ttyasrt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 .local/bin/ttyasrt (limited to '.local/bin/ttyasrt') 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 -- cgit v1.2.3