SHRI G.
S INSTITUTE OF TECHNOLOGY AND SCIENCE, INDORE DEPARTMENT OF INFORMATION
TECHNOLOGY
BETCH II YEAR III SEM SECTION A/SECTION B
SUBJECT CODE: IT28498/SUBJECT NAME: SSL- I (LINUX SHELL PROGRAMMING)
ASSIGNMENT-6
S.NO CASE STUDY CO BO
1. Write a shell script that does the following:
1. Use a for loop to print the numbers from 1 to 5.
2. After the loop ends, print a message saying "Loop
completed."
2. Write a shell script that does the following:
1. Use a for loop to iterate over the numbers from 1 to 10.
2. For each number:
o Print whether the number is even or odd.
3. Write a shell script that does the following:
1. Use a for loop to loop through a list of three colors:
"red", "green", and "blue".
2. For each color, print a message saying "I like [color]".
4. Write a shell script that does the following:
1. Use a for loop to iterate over the numbers from 1 to 10.
2. Inside the loop, calculate the square of each number and
print the result.
5. Write a shell script that does the following:
1. Use a for loop to iterate over the numbers from 5 to 15.
2. For each number:
o Check if the number is divisible by 3.
o If it is divisible by 3, print "Number [x] is
divisible by 3".
o If it is not divisible by 3, print "Number [x] is not
divisible by 3".
6. Write a shell script that does the following:
1. Use a for loop to iterate through the numbers from 1 to
20.
2. For each number:
o Check if the number is prime.
o If the number is prime, print "Number [x] is
prime."
o If the number is not prime, print "Number [x] is
not prime."
7. Write a shell script that does the following:
1. Use a for loop to iterate through the first 10 natural
numbers (1 to 5).
2. For each number, print the number and its
corresponding multiplication table up to 5.
8. Write a shell script that does the following:
1. Use a for loop to iterate over the numbers from 1 to 10.
2. For each number, calculate and print the factorial of that
number.
9. Write a shell script that does the following:
1. Use a for loop to iterate through a list of numbers: 2, 4,
6, 8, 10.
2. For each number, check if it is even or odd and print a
message accordingly.
10. Write a shell script that performs the following tasks using a
for loop:
1. List all .txt files in a directory.
2. For each .txt file, display the file name, word count, and
line count.