Dr. Mark Humphrys

School of Computing. Dublin City University.

Online coding site: Ancient Brain

coders   JavaScript worlds

Search:

Free AI exercises


Einstein - simple Shell scripts

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

Scripts must use the names below.



  1. ls2.sh
    • List files ending in ".txt" in current directory. Long format.

    
    
  2. peekpass.sh


    Note on password file

    (Not needed to do practical.)

    The password file may not contain a list of all users.
    See also the getent command.

     getent passwd 
    
    
  3. grep2.sh
    • Write a script to search for a string in a file.
    • The string is "queen" in lower case.
    • The file is the play Macbeth:
       /users/tutors/mhumphrysdculab/share/shakespeare/macbeth/complete.html 
    • 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.

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

    
    
  5. alldir.sh
    • List all directories underneath /etc
    • Use "find".