From: Einar Jørgen Haraldseid Date: Mon, 14 Jan 2019 14:57:14 +0000 (+0100) Subject: Overskrev en fin patch ved et uhell, la inn igjen X-Git-Url: https://git.slaskete.net/einar-bin/commitdiff_plain/0f07fcdba9f267c96fa141be6eb08ea6b676998d?hp=923533b96d6643e386aa2b917657fc8384977d69 Overskrev en fin patch ved et uhell, la inn igjen --- diff --git a/middag.sh b/middag.sh index 38ec5ae..ff294c2 100755 --- a/middag.sh +++ b/middag.sh @@ -34,28 +34,13 @@ Sides=( 'potetmos' ) -PrepCount=0 -while [ "x${Prep[PrepCount]}" != "x" ]; do - ((PrepCount++)) -done - -MeatCount=0 -while [ "x${Meat[MeatCount]}" != "x" ]; do - ((MeatCount++)) -done - -SideCount=0 -while [ "x${Sides[SideCount]}" != "x" ]; do - ((SideCount++)) -done - PrepN=$RANDOM -(( PrepN %= $PrepCount )) +(( PrepN %= ${#Prep[@]} )) MeatN=$RANDOM -(( MeatN %= $MeatCount )) +(( MeatN %= ${#Meat[@]} )) SideN=$RANDOM -(( SideN %= $SideCount )) +(( SideN %= ${#Sides[@]} )) echo "${Prep[PrepN]} ${Meat[MeatN]} med ${Sides[SideN]}"