Assignment-2 Learn Control Statements
Learn Control Statements- Write the shell scripts
1.Check whether the number is even or odd(if else)
2. Check the quadrant of a given point(x,y) ( if else with multiple conditions)
3. Find the biggest of 3 numbers ( if elif)
4.Enter a month number and print its name( case)
5. Check whether the given number is prime or not ( while)
6.Find sum of the digits of a number.( until)
7.Print all odd numbers less than 50. ( for)
8.Print all the words and its length from a file f. ( for)
9.Check whether the given string is palindrome.(string functions)
10.Print palindrome words from a file(nested loops - for )
11.Print all prime numbers less than 100 ( nested loop -while)
12.Print the words starting with letter ‘a’ in sorted order from a file f.( Hint:use for loop to extract words and write it to another file. Use sort command to sort and then use grep command to extract words starting with letter ‘a’)
Note: We do these programs to learn the syntax of control statements. Shell scripts are not used for doing arithmetic problems.Bash shell support only integer arithmetic.
2. Check the quadrant of a given point(x,y) ( if else with multiple conditions)
3. Find the biggest of 3 numbers ( if elif)
4.Enter a month number and print its name( case)
5. Check whether the given number is prime or not ( while)
6.Find sum of the digits of a number.( until)
7.Print all odd numbers less than 50. ( for)
8.Print all the words and its length from a file f. ( for)
9.Check whether the given string is palindrome.(string functions)
10.Print palindrome words from a file(nested loops - for )
11.Print all prime numbers less than 100 ( nested loop -while)
12.Print the words starting with letter ‘a’ in sorted order from a file f.( Hint:use for loop to extract words and write it to another file. Use sort command to sort and then use grep command to extract words starting with letter ‘a’)
Note: We do these programs to learn the syntax of control statements. Shell scripts are not used for doing arithmetic problems.Bash shell support only integer arithmetic.
Comments
Post a Comment