I followed the following thread How to create a bash script in Linux that checks if the user is local or not
I want to check number of arguments number received before checking the username
username=$1
id -u $username > /dev/null 2>&1
if [ $# -gt 0 ]; then
if [ $? -eq 0 ]; then
echo "$username exists"
else
echo "$username doesn't exist"
fi
else
echo "num of arg are less than expected"
fi
the script doesn't work properly, it always writes that the user exists