X-Git-Url: https://git.slaskete.net/einar-bin/blobdiff_plain/a8e53fff45d7885bf3a8f2d1df47f9b48a2651c8..0f2d1140ed58cbe534c9282e9d1666dab8c6c934:/middag.sh diff --git a/middag.sh b/middag.sh index 9f2b66b..dbb0e14 100755 --- a/middag.sh +++ b/middag.sh @@ -24,28 +24,13 @@ Sides=( 'salat' ) -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]}"