Last active
August 29, 2015 14:10
-
-
Save roktas/eaa0782434315a9f9ce5 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 | |
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