Git and Unix Lab

CS3410 Spring 2015

Due in lab week of Mar. 24

Goal for Today

Write a simple bash script that concatenates files; setup a simple repository on BitBucket

What to submit

  1. submission.txt - A file with your netid as the first line, and containing your git log for that repository in the rest of the file.
  2. script.sh - A script that generates that file for you.

What to do?

  1. Create an account on BitBucket
  2. Create a repository on that account
  3. Init and/or clone the repository
  4. Write your netid in netid.txt
  5. Make a bash script that creates your submission
  6. Submit!

Final contents of script.sh

#! /bin/bash
cat netid.txt > submission.txt
git log >> submission.txt

For the adventurous

Write a script that prompts for your netid if there is no file netid.txt, writes it to netid.txt, and make your submission like in script.sh

To test if a file exists:
    if [ -f "file.txt" ];
    then
        command
    fi

More Info

For more info on UNIX, see man, Linux Pocket Guide (2nd Edition) by Daniel J. Barrett and slides located here