Why does not my code list all user processes? I made a script to delete processes from a user, it's exercise ... Well basically I made a whoami and I got into a variable, after that I made a ps -aux | egrep $ variable, and it returns processes but does not return all of the user does anyone know why? Here is the code, the part of if commented is to terminate the process with the given name, it seems like beast but I am starting in shell script so I am 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