From 893c96a40430d0eb7868019a4d55110f8bd5b1e1 Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Wed, 1 Apr 2015 04:33:52 +0200 Subject: bin/build-rpm-package: add repeat_str() function to... repeat a string. --- bin/build-rpm-package | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bin/build-rpm-package b/bin/build-rpm-package index a598fc4..ca88489 100755 --- a/bin/build-rpm-package +++ b/bin/build-rpm-package @@ -168,6 +168,20 @@ check_mock_version_atleast () { fi } +# Repeats an input string. +# Returns the repeated input string. +repeat_str() { # INPUT COUNT + typeset INPUT="${1:?"Error: no input string passed to ${FUNCNAME}()."}" + typeset COUNT="${2:?"Error: no count passed to ${FUNCNAME}()."}" + + typeset ret="" + typeset -i i=0 + while [ "${i}" -lt "${COUNT}" ]; do + ret="${ret}$(printf "${INPUT}")" + done + printf "${ret}" +} + get_extra_repository () { typeset TYPE="${1:?"Error: no type passed to ${FUNCNAME}()."}" typeset DIST="${2:?"Error: no distribution passed to ${FUNCNAME}()."}" -- cgit v1.2.3