Question: 1) For each of these exercises, write down which command you issued, and record the output that it generated. Answer any questions posed in the
1) For each of these exercises, write down which command you issued, and record the output that it generated. Answer any questions posed in the assignment concisely, but correctly.
( a ) Write a shell script that welcomes you by name and tells you good morning (6am-noon), good afternoon (noon-6pm), good evening (6pm-midnight), or good night (midnight-6am).
Sample run:
$ ./hello.sh Good evening, John Doe.
Hint: read up on the date command and the cut command and take a look at the file /etc/passwd. Your login name is returned by the whoami command and/or by the USER environment variable.
( b ) Expand the program that you write in (2) so that it fetches the most current weather reports for KJFK (JFK Airport), KLGA (LaGuardia Airport), and KISP (Long Island McArthur). Also make it print the current temperature, measured in Fahrenheit.
Sample run:
$ ./helloTemp.sh Good evening, John Doe The current temperature at KJFK is 55 F The current temperature at KLGA is 60 F The current temperature at KISP is 53 F
Hint: use the metar command to obtain a weather report. To convert Celsius to Fahrenheit, use the formula fahrenheit = celsius * 9 / 5 + 32
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
