Created
December 20, 2010 20:25
-
-
Save seddi/748928 to your computer and use it in GitHub Desktop.
/etc/passwd dosyasında kullanıcının istedigi (user,kabuk,group,passwd) alanı listeler ;)
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 | |
alanlar() { | |
! [ $# -eq 1 ] && echo "icerdeyim" && exit 1 | |
ifs_save="$IFS" | |
alan=$1 | |
while read line; do | |
IFS=":" | |
set $line | |
IFS="$ifs_save" | |
case "$alan" in | |
"user") | |
echo "$alan =>> $1" ;; | |
"group") | |
echo "$alan =>> $5" ;; | |
"passwd") | |
echo "$alan =>> $2" ;; | |
"kabuk") | |
echo "$alan =>> $7" ;; | |
*) | |
echo "kullanim : <alan_adi> " | |
echo "alan adlari =>> [ user ], [ passwd ], [ group ], [ kabuk ] " | |
exit 2 ;; | |
esac | |
done </etc/passwd | |
} | |
alanlar $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tmm hocam..