Script pentru afisare utilizatori linux, bash login, home directory

[code]
#!/bin/bash

case $1 in
( list-users )
reset
echo "Listing users..... :) "
cat /etc/passwd |cut -d ':' -f1
;;

( list-valid-users )
reset
echo "Listing valid users for god >:)"
cat test|grep -w  "/bin/sh"$|cut -f1 -d':'
cat test|grep -w  "/bin/bash"$|cut -f1 -d':'
;;
( get-user-home )
reset
echo "Listing the users home...and username"
echo "home directori for:" $2
cat /etc/passwd|grep  $2|cut -f6 -d':'
;;
( * )
reset
echo "Utilizati una din urmatoarele comenzi..."
echo "list-users | list-valid-users | get-user-home <nume utilizator>"

;;

esac
[code]

Share

Leave a Reply