Commit ff2d15be authored by Julius Wu's avatar Julius Wu

fixing q2

parent d60161db
#! /bin/bash
USER_NAME=root
cat /etc/passwd | grep ${USER_NAME} >/dev/null 2>&1
if [ $? -eq 0 ] ; then
echo ~`echo ${USER_NAME}`
else
echo "User Not Found"
fi
\ No newline at end of file
users=($(awk -F: '{ print $1 }' /etc/passwd))
homedir=($(awk -F: '{ print $7 }' /etc/passwd))
for user in "${users[@]}"
do
if [$user == $1]; then
echo ${homedir[$user]}
else
echo "User Not Found"
fi
done
\ No newline at end of file
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