add: kan
This commit is contained in:
parent
99cbb9102f
commit
16d61df3a3
36
scripts/kan
Executable file
36
scripts/kan
Executable file
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user