Check if passed arguments is users

i want to check passed arguments one by one and if it is user print home director of that user

Show us what you did so far, give more clue about your input and also give a sample of what output you expect.

the input will be by user like " user1 user2 anytext "
and the out put must be like
"user1 is user "
"user2 is user "
"anytext not a user"

It is just an example since you don't give much information, i suppose you have root access and that your are using a standard /etc/passwd

for i in $*
do
awk -F: -vU=$i '($1==U) {print "user:"$1" homedir:"$6}' /etc/password
done
1 Like