Skip to content

Instantly share code, notes, and snippets.

@astr0n8t
Created November 13, 2020 20:06
Show Gist options
  • Save astr0n8t/148a3ef20c0beff292fa9e040062c867 to your computer and use it in GitHub Desktop.
Save astr0n8t/148a3ef20c0beff292fa9e040062c867 to your computer and use it in GitHub Desktop.
#!/bin/bash
#ECHO TESTING
echo " "
printf "\033[1;35mInput a number and press [ENTER] to kill that bash session and above (Up to 10)\033[0m\n"
printf "\033[1;32mINPUT: \033[0m"
read num
while true; do
for ((i=$num;i<10;i++)); do
if pgrep -t tty$i > /dev/null; then
var1=`pgrep -t tty$i`
kill -9 $var1
printf "\033[1;31mKILLED\033[0m $var1 \n"
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment