# Midterm Review Lab 1. Write a regular expression to match all of the "hits" and not match any of the "misses." Do not just or together these cases. We are looking for a more general regular expression. (4 pts) * Hits 1. Sam 2. Anina 3. Mary-Kate 4. Rose-Anne 5. W 6. A-B * Misses 1. George-The-King 2. Mary-kate 3. Mary- 4. \- 5. 2Chainz 6. sam 7. s 8. Ke$ha 9. GeorGe 10. Bob Greg * Answer: `[A-Z][a-z]*(\-[A-Z][a-z]*)?` 1. Write a script that navigates to a directory that is supplied by the user as an argument and echo `this directory exists!` if it succeeds. If there is a failure or error, echo `there was an error!`. How is this expression different from what the psuedocode below expresses? ```python if we successfully navigated to ~/penguins: print 'this directory exists!' else: print 'there was an error!' # note: only one of the 2 messages above is ever printed ``` 1. Using the above script that you wrote, how would you send the ouput from `stdout` to `stderr`? From `stderr` to a file called `err.txt`? 1. You want to modify a Python script called `my_script` so that you can execute it using the command `./my_script` (instead of using the command `python my_script`). You know that the version of Python you need for your script is located at `/usr/local/bin/python`. How do you modify `my_script` to meet your needs? You cannot modify/add/delete more than one line in this script. Give exact directions/code changes. **You don't need to write a command here** 2. What do you need to grant a user access to an account over ssh, and where should that file be located? 3. HTAs are technically supposed to be the only people to see all the grades. If HTAs are in their own separate group, what should the permissions be so that only HTAs can see grades? 4. At the end of the semester HTAs need to change grades, so that the next year TAs cannot see them. What should the permissions be changed to such that only a single HTA has read access to grades? 5. What does the lowercase `s` and `t` allow a user to do? Specifically, what special permissions is given to a global user by each?