Skip to content

Instantly share code, notes, and snippets.

@roktas
Last active August 29, 2015 14:10
Show Gist options
  • Save roktas/eaa0782434315a9f9ce5 to your computer and use it in GitHub Desktop.
Save roktas/eaa0782434315a9f9ce5 to your computer and use it in GitHub Desktop.
#!/bin/bash
YASAKLILAR_DOSYASI=yasaklılar.txt
ilkle() {
if [[ ! -f $YASAKLILAR_DOSYASI ]]; then
echo >&2 "$YASAKLILAR_DOSYASI dosyası bulunamadı."
exit 1
fi
}
yasaklimi() {
local aranan=$1
local yasaklilar
local yasakli
yasaklilar=$(cat $YASAKLILAR_DOSYASI)
for yasakli in $yasaklilar; do
if [[ $aranan = $yasakli ]]; then
return 0
fi
done
return 1
}
bodyguard() {
local gelen
for gelen; do
if yasaklimi $gelen; then
echo "üzgünüm giremezsiniz $gelen"
else
echo "hoşgeldiniz $gelen"
fi
done
}
main() {
ilkle
bodyguard "$@"
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment