#!/bin/bash usage='gitFiles [-h] [dir ...] Run git ls-tree and generate list of files under git using the current working or specified directories. Options: -h or -help - print this message' while [[ $1 == -* ]] ; do opt=$1 shift case "$opt" in -h) echo "$usage" > /dev/stderr exit 1 ;; *) echo "Error: invalid option: $opt" > /dev/stderr echo "$usage" > /dev/stderr exit 1 ;; esac done git ls-tree -r --name-only HEAD "$@"