I really want to use ps -aux to get this.
So I wrote script:
#!/bin/bash
if [ $# -lt 1 ]; then
echo -n "No arguments were written"
read uid
else
uid=$1
fi
procesy=`ps -aux | awk '{if ($1=="$uid") print$2}'`
echo $procesy
Why it is not working ?
When I am writinig ./script root I am getting nothing but blank line.
awk.psshould already have an option to output just the process IDs, without having to filter them out of the full output ofps -aux.awkif you have a solution that doesn't useawkfeel free to add.awk?