Question: I need to ask for a username and print the name and home directory path associated with that username

```
echo Please enter your username
read username

```

I am not sure how to use $username to locate information regarding its home directory and name.

Answer: 
`awk -F: -v v="$username" '{if ($1==v) print $6}' /etc/passwd`

Without awk:

`cat /etc/passwd | grep "$username" | cut -d ":" -f6`

User name:

`cat /etc/passwd | grep "$username" | cut -d ":" -f5`
use [`getent`](http://man.cx/getent)

```
read -p "username: " username
IFS=: read username password uid gid gecos homedir shell < <(getent passwd "$username")
echo "fullname=${gecos%%,*}"
echo "homedir=$homedir"

```