title: bash script variable that sets command causes command not found error
body: <p>I'm writing a script that searches a bunch of AWS accounts for IP addresses. I'm setting the jq command based on the input of the user. </p>
  
  <p>The error I'm getting is this:</p>
  
  <pre><code>./aws_utils.sh: line 1434: jq -r '.Reservations[].Instances[].PrivateIpAddress': command not found
  </code></pre>
  
  <p>I'm trying to set the variable that sets the jq command with this code:</p>
  
  <pre><code>echo "Find IP Address in AWS"
  
  echo "Search for Public or Private IP Addresses?"
  echo "Enter public/private:"
  read -r search_scope
  
   if [[ "$search_scope" = "public" ]]; then
     set_search="jq -r '.Reservations[].Instances[].PublicIpAddress'"
   elif [[ "$search_scope" = "private" ]]; then
     set_search="jq -r '.Reservations[].Instances[].PrivateIpAddress'"
  else
    echo "Invalid Input"
  fi
  </code></pre>
  
  <p>When the script runs this line of code is when the error occurs:</p>
  
  <pre><code>search_result=$(aws ec2 describe-instances --profile="$aws_env" | "$set_search" | /bin/grep -v null | /bin/grep \"$ip_address\")
  </code></pre>
  
  <p>If I run the same command on the command line, I don't get an error:</p>
  
  <pre><code>aws ec2 describe-instances --profile=nonprod | jq -r '.Reservations[].Instances[].PrivateIpAddress' | /bin/grep -v null | /bin/grep 10.48.167.228
  10.48.167.228
  </code></pre>
  
  <p>Why is the jq command producing a command not found error in the script?</p>