Dr. Mark Humphrys

School of Computing. Dublin City University.

Online coding site: Ancient Brain

 

Search:


Einstein - simple Shell scripts




Test locally on Shakespeare files

  1. You need some data to test the following on locally.
  2. So first: Download your own copy of the Shakespeare files.



Write the following Shell scripts

Upload the following scripts to Einstein until you pass all the tests.

Scripts must use the names below.
(The names may be clues!)

  
  1. ls3.sh
    • List files ending in "html" in current directory.

  2. ls4.sh
    • List files ending in "html" in all sub-directories of current directory.

  3. dr.sh
    • List files in current directory, in reverse order. See "man ls" for the switch to use.

  4. du2.sh
    • List all directories below current directory and sort them by size.

      
    
  5. grep2.sh
    • Write a script to search for a string in a file.
    • The string is "queen" in lower case.
    • The file is (in your Shakespeare directory):
        macbeth/complete.html 
    • First, test it locally. There should be 4 hits.
    • Once you are happy it is working, change the filename to
       macbeth.htm 
      (with no directory in front of it) and upload it.

      
    
  6. grep3.sh
    • Same as above except script is to print lines containing "queen", ignoring case.