From 16d61df3a3a1784c0f442239da471b85b9dcbb6e Mon Sep 17 00:00:00 2001 From: thek4n Date: Sun, 28 Nov 2021 19:51:18 +0300 Subject: [PATCH] add: kan --- {functions => scripts}/awit.sh | 0 {functions => scripts}/del_logs.sh | 0 scripts/kan | 36 ++++++++++++++++++++++++++++++ {functions => scripts}/luks.sh | 0 4 files changed, 36 insertions(+) rename {functions => scripts}/awit.sh (100%) rename {functions => scripts}/del_logs.sh (100%) create mode 100755 scripts/kan rename {functions => scripts}/luks.sh (100%) diff --git a/functions/awit.sh b/scripts/awit.sh similarity index 100% rename from functions/awit.sh rename to scripts/awit.sh diff --git a/functions/del_logs.sh b/scripts/del_logs.sh similarity index 100% rename from functions/del_logs.sh rename to scripts/del_logs.sh diff --git a/scripts/kan b/scripts/kan new file mode 100755 index 0000000..4f7a725 --- /dev/null +++ b/scripts/kan @@ -0,0 +1,36 @@ +#!/bin/bash + + +current_tty=$(tty) + +ttys=$(ps aux | grep "$(basename "$SHELL")$" | grep "^$USER\s" | awk '{print("/dev/"$7)}' | grep -v "$current_tty") + +while getopts ":l :d :c :s" opt; do + + # shellcheck disable=SC2213 + case $opt in + l) + echo -e "$current_tty - Current\n$ttys" | sort + ;; + d) + for i in $ttys + do + echo -e "\nkan: detect: $i" > "$i" & + done + ;; + c) + echo "$current_tty" + ;; + s) + read -r input_text + for i in $ttys + do + echo "$input_text" > "$i" + done + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + ;; + esac +done + diff --git a/functions/luks.sh b/scripts/luks.sh similarity index 100% rename from functions/luks.sh rename to scripts/luks.sh