X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fcore%2Ffunctions.sh;h=6572a48656192f469236c298ed7b145335247dad;hb=a83016b3ed6efc45f499dac88e06de66a1004611;hp=af8a852f7eb809f69dd76299b992d4760dbf6698;hpb=849dfeac6e62000c1630a6fae6d6c1d6efecd350;p=feisty_meow.git diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index af8a852f..6572a486 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -83,16 +83,10 @@ if [ -z "$skip_all" ]; then # when passed a list of things, this will return the unique items from that list as an echo. function uniquify() { - # change the eol character so things are easier. -echo "list before uniquify: $*" >~/uniquify.out - HOLDIFS="$IFS" - IFS=' ' - # do the uniquification. - local chewed="$(echo $* | sort | uniq)" - echo $chewed -echo "list after uniquify: $chewed" >~/uniquify.out - # return the former eol characters to their place. - IFS="$HOLDIFS" + # do the uniquification: split the space separated items into separate lines, then + # sort the list, then run the uniq tool on the list. results will be packed back onto + # one line when invoked like: local fredlist="$(uniquify a b c e d a e f a e d b)" + echo $* | tr ' ' '\n' | sort | uniq } # sets the variable in parameter 1 to the value in parameter 2, but only if