CSCI-230: Linux Class Exercise



CSCI-230: Linux Class ExerciseObjective: Gain familiarity with the Linux OS and some of its basic functionalities.Using a text editor (such as emacs), create a data file called book.addr in your home directory with appropriate permissions so that the owner can modify and view the file, group members can view it, and others have no access. This file is an address book and should contain entries for people;?e.g., you might have the following entry for me: (entries are formatted as: First_Name Last_Name Title Phone#) Jim Schnepf Associate Professor Phone: 363-2837 Note that each entry is a single line. Include at least 5 entries in the file. (Don't include any blank lines or any comment lines.)Create a csci230bin directory within your CSCI230 on your home directory (using mkdir command), with appropriate permissions so you have access to all files within, group members have read-only access, and others have no access.We are going to place executable shell scripts inside folder CSCI230/csci230bin so we need to add CSCI230/csci230bin to the $PATH system variable in order for shell to locate those scripts when called without having the user to type the complete path every time.?When updating the PATH variable, make sure you don’t erase the old value (otherwise shell won’t be able to find other programs). Issue a command such as (provided that your CSCI230/csci230bin is on your home): setenv PATH ~/ CSCI230/csci230bin:$PATH Using the editor, create another file called lookup (a shell script) in your csci230bin directory with appropriate permissions (so you can view, modify and execute your script, group members can view and execute your script, and others have no access).?When run, lookup should find entries (lines) in your book.addr file matching any of the specified parameters and display them. For example, lookup Schnepf should display any line (the whole record) that contains the string Schnepf.? The output MUST be sorted.? (HINT: use grep, sort, and script parameters). PS: Run the script from your home directory where the book.addr file is located. Your lookup script should execute properly ONLY IF the user specifies a single parameter (error messages must be displayed in other cases to notify the user of the EXACT problem (i.e. either too fee or too many parameters)).It is much easier to solve the above part using the command line first; only afterwards put the commands into the lookup script.?You can try to search for some specific name in your book.addr file at the command line, say Schnepf. When you get the search to work properly, add the command to sort the result. When this works, just put that command line in your ~/CSCI230/csci230bin/lookup file (where ~ represents your Linux home directory), add a comment to describe every line in your shell script, make that file executable, and try it out. The result should be exactly the same as when you ran the commands from the command line. Finally change Schnepf to a parameter so your lookup command will find other people too. Add creative extras if you like!. Create another shell script file called SearchTarEmail (with appropriate comments to describe every script line) in the csci230bin directory thatsearches for all files (only) in your home directory, having a .addr extension which have been modified within the last 30 days, zips all those files into one folder called addr.zip, places the zipped folder in your csc230bin folder,cleans the csci230bin directory by searching and removing all temporary files ending with a ~,tars the csci230bin directory as csci230bin.tar,and, finally, opens the pine mail software to enable you to email the tarred folder to me ( HYPERLINK "mailto:jschnepf@csbsju.edu" jschnepf@csbsju.edu) (and CC yourself) and with other proper email information (i.e. subject, attachments and body).(If your script gets stuck, you can exit it by pressing ^ and c simultaneously.) ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download