I am stuck on a little problem. I have a command which pipes output to awk but I want to capture the output of to an array one by one.
My example:
my
Use Bash's builtin mapfile (or its synonym readarray)
readarray
mapfile -t -s 1 myarr < <(ps -u myusername | awk '{print $1}')
At least in GNU/Linux you can format output of ps, so no need for awk and -s 1
ps
awk
-s 1
mapfile -t myarr < <(ps -u myusername -o pid=)