My goal is to write a script that will show all the running processes and ask the user if they want to kill each process... For each instance of a process with that name, ask the user if they would like to remove it. Remove only the processes the user answers yes (and they must type yes, not just y).
#!/bin/bash
ps
PID TTY TIME CMD
1681 pts/1 00:00:00 tcsh
1690 pts/1 00:00:00 bash
1708 pts/1 00:00:00 script
1710 pts/1 00:00:00 ps
echo "Do you wish to kill PID?"
select yesno in "Yes" "No"; do
case $yesno in
Yes ) $ kill -9;;
No ) exit;;
Im not 100% sure how to ask the question to kill each process, and how to have the PID change for each question. I know I have to create a variable, I just don't know exactly how to assign the variable to each PID...