4th-sem-BA-Unix-Scheme
4th-sem-BA-Unix-Scheme
Code - 31453
September/October 2024
(CBCS Scheme)
Computer Science
SCHEME
SECTION A
SECTION B
II. Answer any FIVE questions : (5 x 3 = 15)
18. Write a shell program to check whether a given year is a leap year or not.
echo "Enter a year:"
read year
if [ $((year % 4)) -eq 0 ] && [ $((year % 100)) -ne 0 ] || [ $((year % 400)) -eq 0 ];
then
echo "$year is a leap year."
else
echo "$year is not a leap year."
Fi
SECTION C
SECTION D
Shell: An interface for users to interact with the kernel, allowing them to execute
commands.
Utilities and Applications: Higher-level tools that provide additional functionalities,
such as text editors and file management commands.
31. (a) Write a shell script to print the multiplication table for a given number.
echo "Enter a number:"
read num
for i in {1..10}; do
echo "$num * $i = $((num * i))"
done
(b) Write a shell script to count lines, words, and characters in its input.