Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.50 KB | None | 0 0
  1. #/bin/bash
  2. #exercise: Boi Chung
  3.  
  4. echo -n "input 2 numbers, b >= a: "
  5. read a b
  6.  
  7. if [ $b -ge $a ]; then
  8.         for ((i=$a; i<=$b; i++ )); do
  9.                 if [ $(($i % 7)) -eq 0 ]; then
  10.                     echo -n "abc "
  11.                 elif [ $(($i % 13)) -eq 0 ]; then
  12.                     echo -n "xyz "
  13.                 elif [ $(($i % 7)) -eq 0 ] && [ $(($i % 13)) -eq 0 ]; then
  14.                     echo -n "abcxyz "
  15.                 else
  16.                     echo -n "$i "
  17.                 fi
  18.         done
  19. else
  20.         echo "b=$b < a=$a, wrong!"
  21.         exit 1
  22. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement