CSC220 Homework 1 2010
Problem #1
Write a script that lists all the users on grendel by year of last access to their account. The output should list all the years starting in 2005 and ending in 2010.
An example of the output could be
2005:
2006:
drwx------ 4 root root 16384 Jul 11 2006 lost+found/ (not really a user but that is ok)
drwxr-xr-x 3 flatland users 4096 Jul 11 2006 flatland/
drwxr-xr-x 7 bmikic faculty 4096 Jul 11 2006 bmikic/
drwxr-xr-x 23 102155 users 4096 Aug 3 2006 mmartin2/
2007:
drwxr-xr-x 3 root root 4096 Apr 18 2007 keterhome/
drwxr-xr-x 155 cleung users 12288 May 18 2007 snida/
drwxr-xr-x 43 zeno users 20480 Aug 14 2007 zeno/
etc...
- store your script in a file called allUsersByDate.sh and submit it as follows:
submit hw1 allUsersByDate.sh
- (For those of you who have never used our class system before, you need to be logged in your 220a-xx account to submit your programs. They get copied to the instructor's directory automatically, and time-stamped. You can submit a program as many times as you want, but be aware that each submission overwrites the previous contents of a file.)
Problem #2
- Same as Problem #1, but this time the output should be just the user's name, not the whole line showing the permissions, date, etc.
- Your output should not include the lost+found, which is not a user but just a regular directory.
- Example:
2006:
flatland/
bmikic/
mmartin2/
- Store your script in a file called allUsersByDate2.sh and submit it as follows:
submit hw1 allUsersByDate2.sh
Problem #3
- Write a script that contains all the answers to the questions in Lab #1.
- Make your script output (echo) the name of the section and the question before each output. For example
Path-Related Questions: Question 1 /Users/classes/220a/ Path-Related Questions: Question 2 100e 102b 103a 105b 107a 111b 220a 240a 352b 400b archive_old_accts.pl testd3 102a 102c 105a 105c 111a 111c 231a 249b 353a acctlist OLD
Warning! When I execute your script, I will not be in your home directory, but in a different directory, somewhere in /Users/classes/220a/handin/... Therefore, make sure that you test your script by running it from a directory other than your main directory. For example, you can create a new directory in your account, copy your script there, cd to the directory, and run the script from there.