From b7759f7294cf49bb11295a5a6141116e61f1eb8e Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Thu, 12 Oct 2017 18:02:53 -0400 Subject: [PATCH] more uniquifying added a function for the unique line code, shortening things a lot. --- scripts/core/functions.sh | 12 ++++++++++++ scripts/rev_control/version_control.sh | 9 ++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index 1fe45e6c..6c6832ae 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -80,6 +80,18 @@ if [ -z "$skip_all" ]; then IFS="$HOLDIFS" } + # 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. + HOLDIFS="$IFS" + IFS=' ' + # do the uniquification. + echo $* | uniq + # return the former eol characters to their place. + IFS="$HOLDIFS" + } + # sets the variable in parameter 1 to the value in parameter 2, but only if # that variable was undefined. function set_var_if_undefined() diff --git a/scripts/rev_control/version_control.sh b/scripts/rev_control/version_control.sh index 2506a608..c27f6895 100644 --- a/scripts/rev_control/version_control.sh +++ b/scripts/rev_control/version_control.sh @@ -204,18 +204,13 @@ function do_report_new # checks in all the folders in a specified list. function checkin_list() { -echo list originally was: $* - # make the list of directories unique. - HOLDIFS="$IFS" - IFS=' ' - local list="$(echo $* | uniq)" - IFS="$HOLDIFS" +echo list originally was: $* + local list="$(uniquify $*)" echo list became $list #hmmm: if above works, then it's needed in other places that # are passed lists. -#hmmm: in fact, shouldn't it be a handy function of some sort for uniquifying lists? save_terminal_title -- 2.34.1