# Problem 5:

1. If `file.txt` exists, then `touch file.txt` will only update its modification time.
   On the other hand, `cat /dev/null > file.txt` will erase its content.

   The commands `touch file.txt` and `cat /dev/null >> file.txt` will behave identically
   since they will both update the modification time of `file.txt` (or create it if it
   did not exist) and neither command will alter its content, if it already existed.


2. Several ways (see lecture slides from Weeks 1 & 2).

   Option 1: Escape the dollar sign.

     echo "I like \$x"

   Option 2: Use single quotes to prevent variable substitution.

     echo 'I like $x'


3. The second piece of code will yield a syntax error. The reason this happens is that
   there is no space between "[" and "-f", so bash tries to parse "[-f" as a command.


4. We redirect to `/dev/null` to avoid printing the output of the `grep` command to the terminal,
   since we only care about its exit status.


5. While there is a user whose name contains "vasilis" logged on to the system, it will print "Checking..."
   and "Still here", and sleep for 5 seconds before retrying. When that user logs out, the code will
   terminate.


# Problem 6

1. `git branch <newbranch>` and `git checkout -b <newbranch>`.

2. We should maintain the following:
   * one `master` branch, containing the "stable" code that most users should download
   * one `testing` branch, containing code that has been tested by the developers but has not yet been tested extensively by users
   * one or more `feature<X>` branches, where developers implement new features.

   Branch management:
   * When a feature X is implemented, its `feature<X>` branch should be merged into `testing`, and the `feature<X>` branch itself should stop existing.
   * When users find bugs in `testing`, developers can push hotfixes directly to the `testing` branch.
   * When enough new features have been added into `testing` (e.g. a milestone has been reached), `testing` can be merged back to `master`.

3. A merge commit has multiple parents, so in order to reverse a commit `git revert` will also need to know which parent it should revert to.
   This is why there is an `-m` flag to specify the parent (see `man git revert` for the precise documentation).
