Skip to content

Instantly share code, notes, and snippets.

@ynonp
Created June 28, 2012 08:10
Show Gist options
  • Save ynonp/3009833 to your computer and use it in GitHub Desktop.
Save ynonp/3009833 to your computer and use it in GitHub Desktop.
Bash Syntax Exercises

Bash Syntax Exercises

  1. Write a program that reads 10 numbers from the user and prints the largest of them

  2. Write a program that randomizes 7 numbers and prints their sum. If that sum is divisable by 7, it should also print 'Boom !'. (You can use the % operator that means modulus).

  3. Write a program that randomizes a number and calculates the sum total of its digits.

  4. Write a program that reads lines from a user. When input ends, the program should print every other line.

  5. Write a program that randomizes numbers in a loop until it reaches a number that is divisable by 7, 13 and 15. Then prints that number

  6. Write a program that reads a number n from the user, then randomizes n numbers and prints their sum, average and max.

Bash Arrays Exercises

  1. Write a program that reads a file and print out its lines in reverse order
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment