Commit 30f127fa authored by vagrant's avatar vagrant

solved problem 2

parent d5ec3790
#!/bin/bash
user=$1
homedir=""
input="/etc/passwd"
while read -r line
do
parseuser=$(echo $line | cut -d":" -f1)
if [ $parseuser == $user ]
then
homedir="$(echo $line | cut -d":" -f6)"
fi
done < "$input"
if [$homedir == ""]
then
echo "User \"$user\" not found"
else
echo "Home directory: $homedir"
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment