From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tremer To: network@lists.ipfire.org Subject: Re: [PATCH 1/6] util: new function abs Date: Wed, 14 Jun 2017 22:22:43 +0100 Message-ID: <1497475363.2416.18.camel@ipfire.org> In-Reply-To: <1497003452-10190-1-git-send-email-jonatan.schlag@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5699830368720980262==" List-Id: --===============5699830368720980262== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Merged. :) On Fri, 2017-06-09 at 12:17 +0200, Jonatan Schlag wrote: > This function return the absolute value of a given number. > > Signed-off-by: Jonatan Schlag > --- >  src/functions/functions.util | 10 ++++++++++ >  1 file changed, 10 insertions(+) > > diff --git a/src/functions/functions.util > b/src/functions/functions.util > index 4b6f956..699026d 100644 > --- a/src/functions/functions.util > +++ b/src/functions/functions.util > @@ -268,6 +268,16 @@ uuid() { >   echo $(  } >   > +abs() { > + local val=${1} > + > + if [ ${val} -lt 0 ]; then > + (( val *= -1 )) > + fi > + > + echo ${val} > +} > + >  rand() { >   local uuid="$(uuid)" >   echo "${uuid//-/}" --===============5699830368720980262== Content-Type: application/pgp-signature Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="signature.asc" MIME-Version: 1.0 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KVmVyc2lvbjogR251UEcgdjIKCmlRSWNCQUFC Q2dBR0JRSlpRYWtqQUFvSkVJQjU4UDl2a0FrSE1BY1Ard1lSRHVJcHB2YVhJdERGcEk5QloxOTYK R3JQTC9uUnFsNUpHN2diNHZOaUg1QjI1THRVQWJOZE12NmE5SEpmM015TVIvNzA3elUyTDNxeDhh UGJVVHlMUQp6bEJOVlpHNnM4YmROek83MXFINjU2SmhmWjJaYkZobTdiQjJOendoWEdrMDVPVHZJ MGJQenI0QXhPNis4bkFOCjd5b01zd3RlOWxCcmE0UU9oTkxlMGxhY2U1NDR3RlNLNWY2QU4yUnNs cHFYMDB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