Fix xargs misbehaving when there are no packages

Adding the -r argument to xargs makes it not run for no reason when
there are no packages to trim spaces from. Otherwise it'd always run at
least once and sometimes misbehave.
This commit is contained in:
caem 2024-05-10 13:15:31 +02:00
parent 39a5c0ca67
commit 7f35cdc86a
No known key found for this signature in database
GPG key ID: 3BCEDBB0C38805DA

View file

@ -7,7 +7,7 @@ table_start=$(echo "$package_list" | grep -n "S | Repository | Name"| gawk '{pri
unneeded_packages=() unneeded_packages=()
while IFS= read -r package; do while IFS= read -r package; do
package="$(echo "$package"| awk -F '|' '{ print $3 }' | xargs)" package="$(echo "$package"| awk -F '|' '{ print $3 }' | xargs -r)"
unneeded_packages+=("$package") unneeded_packages+=("$package")
done < <(echo "$package_list" | tail -n+$((table_start+2))) done < <(echo "$package_list" | tail -n+$((table_start+2)))