Skip to content

Instantly share code, notes, and snippets.

@seddi
Created December 20, 2010 20:25
Show Gist options
  • Save seddi/748928 to your computer and use it in GitHub Desktop.
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 ;)
#!/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
@seddi
Copy link
Author

seddi commented Dec 20, 2010

tmm hocam..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment