title: Scripting keeps by-passing the if statement when running in the shell
body: <p>I am working on a very common assignment for my Unix class that asks me to do the following.</p>
  
  <p><Blockquote> Write a shell script that loops through all of its arguments using $*. Treat each of these arguments
  as if it were a user name in the Unix server, though one or two may not be. The script should
  also perform following tasks:
  If the username is not in /etc/passwd, then the script reports that they are not in the password
  file.
  If the username is flagged as disabled, then the script reports that the account is
  disabled.
  </Blockquote></p>
  
  <p>I wrote the following script:</p>
  
  <pre><code>read -p "Please input a user name: "
  cat /etc/passwd | grep "$*" wc -l &gt; compare
  
  if [[ $compare == 0 ]]
  then echo "Username not found."
  
  else
  cat compare | grep "disabled" | wc -l
  
  fi
  </code></pre>
  
  <p>My idea was simple. Turn the result of the WC into a number. If it found the user it would produce a 1, if not a zero. Compare that number in an if statement and nest if statements inside each other to pull off the instructions. Unfortunately, the script seems to skip over the first if statement that compares the value of the compare file to zero. My question is does anyone see why my script is skipping the if case and going right to the elif? If I can nail that down I feel like I can complete this part of the assignment.</p>
  
  <p>Thank you for considering this request and any help you can give!</p>