Sorry for maybe a noob question but I am pretty new to Linux. I am trying to get all output from following command in an array and loop through it (in bash).
packages=$(dpkg-query --show --showformat='${Package}' )
for p in "${packages[@]}"; do
echo "Package: ${p}"
done
I don't know what I am doing wrong, but maybe someone can help me out.
Thanks in advance.
Greetings MC
Thanks for you help. my solution now is this:
while IFS= read -r line; do
echo "${line}"
done <<< "$(dpkg-query --show --showformat='${Package}\n')"