exercism

Exercism solutions.
git clone git://code.dwrz.net/exercism
Log | Files | Refs

raindrops.sh (303B)


      1 #!/usr/bin/env bash
      2 
      3 main() {
      4   local name=""
      5 
      6   if [ $(($1 % 3)) -eq 0 ]; then
      7     name="Pling"
      8   fi
      9 
     10   if [ $(($1 % 5)) -eq 0 ]; then
     11     name="${name}Plang"
     12   fi
     13 
     14   if [ $(($1 % 7)) -eq 0 ]; then
     15     name="${name}Plong"
     16   fi
     17 
     18   if [ "$name" = "" ]; then
     19     name="$1"
     20   fi
     21 
     22   echo $name
     23 }
     24 
     25 main "$@"