Example / Exercise

  1. Connect: ssh login.itd.umich.edu
  2. Print host: hostname
  3. Print working directory: pwd
  4. Create a directory: mkdir 506
  5. Move to that directory: cd 506
  6. Create a basic README.md to document your work in this folder:
    • echo "## Stats 506" > README.md
    • Append a blank line echo " " >> README.md
  7. Create additional directories:
    • mkdir ./hw; mkdir ./examples
    • mkdir ./data && mkdir ./data/csv
  8. Create multiple directories using a loop
for d in R Stata SAS sh
do
  mkdir ./examples/$d
  echo $d
done

Note the use of ; to execute multiple commands on the same line. It isnโ€™t needed here, but && is used to execute the second command only if the first completes successfully. You can, but are not required to, read more about exit status and exit codes here.