in my terminal:
ps aux|awk '{print $1}'
USER
root
root
root
root
statd
root
root
root
101
daemon
avahi
avahi
103
rtkit
debian
debian
debian
i want to get the output is
USER
root
statd
101
daemon
avahi
103
rtkit
debian
how to write the shell?
You could pipe the command output through sort and then uniq
It gets a little more complicated if you need the list in a specific order.