#! /bin/bash

# Checks whether the last two components of the current directory pathname
# are ${exp}.

exp="$1"; shift # Expected tail of directory.

# Check if the right directory:
thisdir="`pwd`"
parentdir="`cd .. && pwd`"
taildir="${parentdir##*/}/${thisdir##*/}"
echo "directory = ${taildir}"
if [[ "${taildir}" != "${exp}" ]]; then
  echo "** wrong directory, should be */${exp}" 1>&2
  exit 1
fi
