diff --git a/lib.sh b/lib.sh index 0a9c580..f3757c9 100755 --- a/lib.sh +++ b/lib.sh @@ -4,8 +4,9 @@ function normalize_package_list { local stripped=$(echo "${1}" | sed 's/,//g') # Remove extraneous spaces at the middle, beginning, and end. - local trimmed="$(echo "${stripped}" | sed 's/\s\+/ /g; s/^\s\+//g; s/\s\+$//g')" - echo "${trimmed}" | sort + local trimmed="$(echo "${stripped}" | sed 's/\s\+/ /g; s/^\s\+//g; s/\s\+$//g')" + local sorted="$(echo ${trimmed} | tr ' ' '\n' | sort | tr '\n' ' ')" + echo "${sorted}" } # Split fully qualified package into name and version