0
Why doesn’t my code list all user processes? I made a script to delete a user’s processes, it’s exercise... Good basically made a whoami and adiquiri in a variable, after that made a ps -aux | egrep $variable , and it returns processes but does not return all of the user anyone knows why? Here goes the code, the part of the commented if is to end the process with the given name, it looks silly but I’m starting in shell script so I’m not getting
#!/bin/bash
variavel=`whoami`
ps -aux | egrep $variavel
echo "Digite o nome do processo que deseja matar: "
read nome
clear
for processo in $(ps -aux |egrep $variavel |xargs -n1)
do
# if [ $nome == $processo[9] ]; then
#killall $nome
# echo "Processo morto"
# fi