Read the following scenario. Provide the command(s) in the context of the environment established in the scenario. Write your answers on the line under each question.

- Assuming the date string is
Wed Nov 29 14: 00: 52 EDT 2005

1. Write the output of the command: date +%H
2. Write the output of the command: date '+DATE: %m %d %y'
3. Write the output of the following commands:
Y=`date +%y`
echo $Y
4. Write the command(s) to display the sum of the variables x and y
5. Write the command(s) to display the product of the variables x and y
6. Write the command that makes the file called Xfile an executable file
- Assume you have a script file called testing.
You execute testing as follows:
testing one two three and the rest
Write the output of the following commands
7. echo $0
8. echo $2
9. echo $#
10. echo $@
11. echo $*
12. Write the script that displays "hi" five times, using the for loop
13. Write the script that displays "hi" five times, using the while loop
14. Write the script that displays "hi" five times, using the until loop
15. Write the script that reads your name from the keyboard and displays (echoes) it on the screen.
16. Write a script file called cm (change mode) that changes the specified file mode to executable.
The filename is specified on the command line as follows:
cm xyz
17. Write a script file called sdate that reads the system date and displays the date string in the following format:
Time:
Day:
Month:
Year:


1. Write the output of the command: date +%H
=>> 14
2. Write the output of the command: date '+DATE: %m %d %y'
=>> DATE: Nov Wed 2001
3. Write the output of the following commands:
Y=`date +%y`
echo $Y
=>> 2001
4. Write the command(s) to display the sum of the variables x and y
=>> sum=`expr $x + $y`
echo $sum
5. Write the command(s) to display the product of the variables x and y
=>> product=`expr $x \* $y`
echo $product
6. Write the command that makes the file called Xfile an executable file
=>> chmod u+x test
- Assume you have a script file called testing.
You execute testing as follows:
testing one two three and the rest
Write the output of the following commands
7. echo $0
=>> test
8. echo $2
=>> two
9. echo $#
=>> 6
10. echo $@
=>> one two three and the rest
11. echo $*
=>> one two three and the rest
12. Write the script that displays "hi" five times, using the for loop
=>> for x in 1 2 3 4 5
do
echo "hi"
done
13. Write the script that displays "hi" five times, using the while loop
=>> Version 1:
count=1
while [ $count -lt 5 ]
do
echo "hi"
let count=count+1
done
Version 2:
count=1
while [ $count -lt 5 ]
do
echo "hi"
count=`expr $count + 1
done
14. Write the script that displays "hi" five times, using the until loop
=>> Version 1:
count=1
until [ $count -gt 5 ]
do
echo "hi"
let count=count+1
done
Version 2:
count=1
until [ $count -gt 5 ]
do
echo "hi"
count=`expr $count + 1
done
15. Write the script that reads your name from the keyboard and displays (echoes) it on the screen.
=>> echo "Enter your name: \c"
read name
echo " Your name is: $name"
16. Write a script file called cm (change mode) that changes the specified file mode to executable.
The filename is specified on the command line as follows:
cm xyz
=>> chmod u+x "$1"
17. Write a script file called sdate that reads the system date and displays the date string in the following format:
Time:
Day:
Month:
Year:
=>> date '+Time: %H: %M%S'
date '+Day: %d'
date '+Month: %m'
date '+Year: %y'

Computer Science & Information Technology

You might also like to view...

In the chart above, the line to which the red arrow is pointing, is called a(n) ________

Fill in the blank(s) with correct word

Computer Science & Information Technology

The words shown in bold in the following sentence are _____.At the nature center, we saw an owl, a hawk, and a falcon.?

A. ?articles B. ?gerunds C. ?infinitives

Computer Science & Information Technology

According to Android's suggested user interface standards, repeatedly pressing the app icon on an app's action bar will eventually move the device to its home screen.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Digital certificates use a standard format called ____________.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology