From 49b4515f5120731306a7348beb612113ef06b3ea Mon Sep 17 00:00:00 2001 From: awalsh128 Date: Fri, 3 Jun 2022 21:45:00 -0700 Subject: [PATCH] Fix arg ordinals and package sort return. --- lib.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) mode change 100644 => 100755 lib.sh diff --git a/lib.sh b/lib.sh old mode 100644 new mode 100755 index 3802483..063492a --- a/lib.sh +++ b/lib.sh @@ -1,23 +1,19 @@ -#!/bin/bash +#!/bin/bash -x # Sort these packages by name and split on commas. function normalize_package_list { - stripped="$(echo \"${0}\" | sed 's/,//g')" + stripped="$(echo \"${1}\" | sed 's/,//g')" # Remove extraneous spaces at the middle, beginning, and end. trimmed="$(echo \"${stripped}\" | sed 's/\s\+/ /g; s/^\s\+//g; s/\s\+$//g')" - echo "$(\"${trimmed}\" | sort)" + echo "${trimmed}" | sort } # Split fully qualified package into name and version function get_package_name_ver { - IFS=\= read name ver <<< "${0}" + IFS=\= read name ver <<< "${1}" # If version not found in the fully qualified package value. if test -z "${ver}"; then ver="$(grep "Version:" <<< "$(apt show ${name})" | awk '{print $2}')" fi echo 'package_name="${name}"; package_ver="${ver}"' } - -function blah { - > /dev/null 2>&1 -} \ No newline at end of file