Answer:
see explaination
Explanation:
1.
1. grep 'John' FileName
2. grep '^\J' FileName
3. grep 'stopped$' FileName
4. grep -v -e 'was' FileName
5. grep -E '^(k|K)' FileName
2.
#print the message to create subdirectory
echo "Creating a subdirectory to copy current directory files into named 'sub'"
#create subdirectory
mkdir sub
echo "Directory successfully created"
#Copy the files in the current working directory to created subdirectory
echo "Copying files of current directory into newly created subdirectory"
rsync -a --exclude='sub' * sub
#display the message to copy the files
echo "Copying operation completed successfully"
echo "Now deleting the created subdirectory along with its contents"
rm -rf sub
#indicated the message completion of task
echo "Operation completed successfully."
3.
#prompt and read the first number
echo "Enter the first number: "
read x
echo "Enter the second number: "
read y
#Compute arithmetic operations and store in the
#respective variable
addition=$(($x + $y))
subtraction=$(($x - $y))
multiplication=$(($x * $y))
division=$(($x / $y))
#print the values
echo "Addition of $x and $y is $addition"
echo "Subtraction of $x and $y is $subtraction"
echo "Multiplication of $x and $y is $multiplication"
echo "Division of $x and $y is $division"