I have written a script that allows my admins to add a user to our SFTP server.  I have one problem:
 
How do I verify if a user already exists? 
 
I have this, but it gives me unary error when the user doesn't exist because it doens't output a numeric value.
 
#!/bin/sh
 
echo -n "What is the username?"
read var1
 
var2=`/usr/bin/id -u $var1`
 
   if [ $var2 -gt 499 ] ; then
     echo "This user already exists."
   else
      echo "This user does not exist."
   fi
 
 

Reply via email to