Skip to content

Instantly share code, notes, and snippets.

@albertzak
Created April 15, 2016 09:27
Show Gist options
  • Save albertzak/bedab6a9e80f845f50135a010fedd847 to your computer and use it in GitHub Desktop.
Save albertzak/bedab6a9e80f845f50135a010fedd847 to your computer and use it in GitHub Desktop.
#!/bin/bash
fail() {
echo "search: abort due to fatal error." 1>&2
exit 1
}
if [ ! -z $1 ] && [ "--help" == $1 ]; then
echo "V01.01 Vorname Nachname Personenkennzahl"
elif [ ! -z $1 ]; then
START_DIR=$1
if [ -z $2 ]; then
FILE="*"
else
FILE="$2"
fi
find "$START_DIR" -name "$FILE" -print
ERROR=$?
if [ $ERROR -ne 0 ]; then
echo "find returned error code $ERROR"
fail
fi
else
echo "Usage: search {start_dir [file] |--help}"
fail
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment