Write a script to do the following:
Create an array called german_days with the
words Sonntag, Montag,
Dienstag, Mittwoch, Donnerstag,
Freitag, and Samstag. (These correspond
to Sunday through Saturday.)
Set a variable named day_number to the day of the week
in the range 0..6 by executing the date '+%w' command.
Put the date in European numeric form into a variable euro_date
by executing the date '+%d-%m-%Y' command.
Put the date in English into a variable us_date
by executing the code date '+%A, %m/%d/%Y' command.
Set the variable total_files to the number of files in your
current directory by executing the ls command and
piping that result to wc -l.
Set the variable n_directories to the number of subdirectories
in your current directory by executing ls -l, piping that
to grep '^d' and piping that result to
wc -l. (See if you can figure out why this works.)
Set the variable reg_files to be the number of
regular (non-directory) files. You get to figure out how to do this
yourself. Hint: arithmetic is good.
Echo these data as shown below. The items in italics will be filled in by the variables you set in the preceding steps. You must use a “here” document to output the results. Your line breaks must occur exactly where you see them here. Don’t worry about grammar; if you end up with “1 directories” that’s all right.
Heute ist Montag, 07-11-2005. Today is Monday, 11/07/2005. You have 2 directories and 3 regular files for a total of 5 files.
Rename your script file in the form lastname_firstname_shell_vars.sh and email it to the instructor. Put the word CIT052 in the subject line of your email, please.