DEV Community

loading...

Discussion on: Daily Challenge #5 - Ten Minute Walk

Collapse
v613 profile image
Ceban Dumitru

BASH

#!/bin/bash
declare gps=(n s e w);
if [[ $((${1} % 2 )) = 0 ]]; then
    for (( i = ${1}; i >= 0; i-=2 )); do
        echo ${gps[$(($RANDOM%3))]};
    done;
else 
    echo "Sorry, you cannot generate way";
fi