Created
April 15, 2016 09:27
-
-
Save albertzak/bedab6a9e80f845f50135a010fedd847 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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