How do I show the results found in an if then statement?











up vote
1
down vote

favorite












So, what I am trying to do is look for a set of files, and then have it echo which ones it has found. For example, this is what I have



    #!/bin/bash

LaunchDaemon="LaunchDaemon.plist"
launchAgent="LaunchAgent"
mobileLaunchDaemon="MobileDaemon.plist"
mobileAgent="MobileAgent"

if [ -f "$LaunchDaemon" ] || [ -f "$launchAgent" ] || [ -f "$mobileLaunchDaemon" ] || [ -f "$mobileAgent" ]
then
echo "<result>Found</result>"
else
echo "<result>Not Found</result>"
fi


So, this will tell me if it can find any of them, but it won't tell me which one it is finding. I created another with elif statements inside, which works sort of, but if it finds the first one, it stops there and won't tell me if the others are there as well. So, I hope this makes sense, I'm just trying to find a way to display which of the files have been found.










share|improve this question
























  • can't you use if..elif..else..fi statement ?
    – user994144
    Aug 3 '16 at 12:50










  • How about having separate if statements for each of the possible things and build the result string in a variable which is echoed out only in the end?
    – zagrimsan
    Aug 3 '16 at 13:01















up vote
1
down vote

favorite












So, what I am trying to do is look for a set of files, and then have it echo which ones it has found. For example, this is what I have



    #!/bin/bash

LaunchDaemon="LaunchDaemon.plist"
launchAgent="LaunchAgent"
mobileLaunchDaemon="MobileDaemon.plist"
mobileAgent="MobileAgent"

if [ -f "$LaunchDaemon" ] || [ -f "$launchAgent" ] || [ -f "$mobileLaunchDaemon" ] || [ -f "$mobileAgent" ]
then
echo "<result>Found</result>"
else
echo "<result>Not Found</result>"
fi


So, this will tell me if it can find any of them, but it won't tell me which one it is finding. I created another with elif statements inside, which works sort of, but if it finds the first one, it stops there and won't tell me if the others are there as well. So, I hope this makes sense, I'm just trying to find a way to display which of the files have been found.










share|improve this question
























  • can't you use if..elif..else..fi statement ?
    – user994144
    Aug 3 '16 at 12:50










  • How about having separate if statements for each of the possible things and build the result string in a variable which is echoed out only in the end?
    – zagrimsan
    Aug 3 '16 at 13:01













up vote
1
down vote

favorite









up vote
1
down vote

favorite











So, what I am trying to do is look for a set of files, and then have it echo which ones it has found. For example, this is what I have



    #!/bin/bash

LaunchDaemon="LaunchDaemon.plist"
launchAgent="LaunchAgent"
mobileLaunchDaemon="MobileDaemon.plist"
mobileAgent="MobileAgent"

if [ -f "$LaunchDaemon" ] || [ -f "$launchAgent" ] || [ -f "$mobileLaunchDaemon" ] || [ -f "$mobileAgent" ]
then
echo "<result>Found</result>"
else
echo "<result>Not Found</result>"
fi


So, this will tell me if it can find any of them, but it won't tell me which one it is finding. I created another with elif statements inside, which works sort of, but if it finds the first one, it stops there and won't tell me if the others are there as well. So, I hope this makes sense, I'm just trying to find a way to display which of the files have been found.










share|improve this question















So, what I am trying to do is look for a set of files, and then have it echo which ones it has found. For example, this is what I have



    #!/bin/bash

LaunchDaemon="LaunchDaemon.plist"
launchAgent="LaunchAgent"
mobileLaunchDaemon="MobileDaemon.plist"
mobileAgent="MobileAgent"

if [ -f "$LaunchDaemon" ] || [ -f "$launchAgent" ] || [ -f "$mobileLaunchDaemon" ] || [ -f "$mobileAgent" ]
then
echo "<result>Found</result>"
else
echo "<result>Not Found</result>"
fi


So, this will tell me if it can find any of them, but it won't tell me which one it is finding. I created another with elif statements inside, which works sort of, but if it finds the first one, it stops there and won't tell me if the others are there as well. So, I hope this makes sense, I'm just trying to find a way to display which of the files have been found.







bash shell-script






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 at 1:00









Rui F Ribeiro

38.3k1475127




38.3k1475127










asked Aug 3 '16 at 12:46









Ohitsspencer

83




83












  • can't you use if..elif..else..fi statement ?
    – user994144
    Aug 3 '16 at 12:50










  • How about having separate if statements for each of the possible things and build the result string in a variable which is echoed out only in the end?
    – zagrimsan
    Aug 3 '16 at 13:01


















  • can't you use if..elif..else..fi statement ?
    – user994144
    Aug 3 '16 at 12:50










  • How about having separate if statements for each of the possible things and build the result string in a variable which is echoed out only in the end?
    – zagrimsan
    Aug 3 '16 at 13:01
















can't you use if..elif..else..fi statement ?
– user994144
Aug 3 '16 at 12:50




can't you use if..elif..else..fi statement ?
– user994144
Aug 3 '16 at 12:50












How about having separate if statements for each of the possible things and build the result string in a variable which is echoed out only in the end?
– zagrimsan
Aug 3 '16 at 13:01




How about having separate if statements for each of the possible things and build the result string in a variable which is echoed out only in the end?
– zagrimsan
Aug 3 '16 at 13:01










3 Answers
3






active

oldest

votes

















up vote
3
down vote



accepted










You need to split your if test into multiple



if [ -f "$LaunchDaemon" ]
then
echo $LaunchDaemon found
elif [ -f "$launchAgent" ]
then
echo $launchAgent found
elif [ ...
...
else
echo Not found
fi


type structure (fill in the blanks yourself.).



If you want to find all matches just do it as multiple tests, setting a variable to see if anything was found or not



found=0
if [ -f "$LaunchDaemon" ]
then
echo $LaunchDaemon found
found=1
fi
if [ -f "$launchAgent" ]
then
echo $launchAgent found
found=1
fi
...
if [ $found == 0 ]
then
echo Not found
fi


Now sometimes we want to set a variable so we know which one was found. This is common when trying to find a matching program or file (eg in the old days we might have had /usr/lib/sendmail or /usr/sbin/sendmail depending on the OS distribution, so we'd need to search to find it).



found=
for f in "$LaunchDaemon" "$launchAgent" "$mobileLaunchDaemon" "$mobileAgent"
do
[[ -f "$f" ]] && found="$f"
done


Now we have $found pointing to a found entry and can test on that.



if [ -n "$found" ]
then
echo Found: $found
else
echo Nothing found
fi


The second loop can also find all versions with a minor change:



found=
for f in "$LaunchDaemon" "$launchAgent" "$mobileLaunchDaemon" "$mobileAgent"
do
[[ -f "$f" ]] && found="$found $f"
done


The downside of this is that there may be a leading space in front, so we should remove that:



found="${found# }"





share|improve this answer





















  • +1. BTW, a minor modification of that final for loop can be used to choose a file to use from one of several dirs - e.g. for d in /etc/program /usr/share/program /usr/local/etc ~/.program ; do [ -e "$d/conf" ] && configfile="$d/conf" ; done; [ -z "$configfile" ] && echo "no config found" && exit 1 - the last one found will be used, so dirs are in order from lowest to highest priority.
    – cas
    Aug 4 '16 at 5:03


















up vote
1
down vote













An array would be the best approach here



#!/bin/bash
#Store the filenames in an array, also less management overhead
arry=( "LaunchDaemon.plist" "LaunchAgent" "MobileDaemon.plist" "MobileAgent" )
#Optioinally if you wish to add one more file to check you could
#uncomment the below line
#arry+=("$1") #One more file added from the command line
for i in "${arry[@]}" #Iterate through each element using a for loop
do
if [ -f "$i" ]
then
echo "<result> $i Found</result>"
else
echo "<result> $i Not Found</result>"
fi
done





share|improve this answer






























    up vote
    0
    down vote













    try this



    #!/bin/bash
    search_LaunchDaemon="LaunchDaemon.plist"
    search_launchAgent="LaunchAgent"
    search_mobileLaunchDaemon="MobileDaemon.plist"

    for filex in ${!search_*}
    do
    found=${!filex}
    #echo -e "${filex}=${!filex}"
    #we remove the prefix "search_"
    IFS="_" read part1 part2 <<< "${filex}"

    if [[ -f $found ]];
    then
    echo "I have found ${part2}"
    else
    echo "${part2} not found!"
    fi
    done





    share|improve this answer





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f300030%2fhow-do-i-show-the-results-found-in-an-if-then-statement%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      3
      down vote



      accepted










      You need to split your if test into multiple



      if [ -f "$LaunchDaemon" ]
      then
      echo $LaunchDaemon found
      elif [ -f "$launchAgent" ]
      then
      echo $launchAgent found
      elif [ ...
      ...
      else
      echo Not found
      fi


      type structure (fill in the blanks yourself.).



      If you want to find all matches just do it as multiple tests, setting a variable to see if anything was found or not



      found=0
      if [ -f "$LaunchDaemon" ]
      then
      echo $LaunchDaemon found
      found=1
      fi
      if [ -f "$launchAgent" ]
      then
      echo $launchAgent found
      found=1
      fi
      ...
      if [ $found == 0 ]
      then
      echo Not found
      fi


      Now sometimes we want to set a variable so we know which one was found. This is common when trying to find a matching program or file (eg in the old days we might have had /usr/lib/sendmail or /usr/sbin/sendmail depending on the OS distribution, so we'd need to search to find it).



      found=
      for f in "$LaunchDaemon" "$launchAgent" "$mobileLaunchDaemon" "$mobileAgent"
      do
      [[ -f "$f" ]] && found="$f"
      done


      Now we have $found pointing to a found entry and can test on that.



      if [ -n "$found" ]
      then
      echo Found: $found
      else
      echo Nothing found
      fi


      The second loop can also find all versions with a minor change:



      found=
      for f in "$LaunchDaemon" "$launchAgent" "$mobileLaunchDaemon" "$mobileAgent"
      do
      [[ -f "$f" ]] && found="$found $f"
      done


      The downside of this is that there may be a leading space in front, so we should remove that:



      found="${found# }"





      share|improve this answer





















      • +1. BTW, a minor modification of that final for loop can be used to choose a file to use from one of several dirs - e.g. for d in /etc/program /usr/share/program /usr/local/etc ~/.program ; do [ -e "$d/conf" ] && configfile="$d/conf" ; done; [ -z "$configfile" ] && echo "no config found" && exit 1 - the last one found will be used, so dirs are in order from lowest to highest priority.
        – cas
        Aug 4 '16 at 5:03















      up vote
      3
      down vote



      accepted










      You need to split your if test into multiple



      if [ -f "$LaunchDaemon" ]
      then
      echo $LaunchDaemon found
      elif [ -f "$launchAgent" ]
      then
      echo $launchAgent found
      elif [ ...
      ...
      else
      echo Not found
      fi


      type structure (fill in the blanks yourself.).



      If you want to find all matches just do it as multiple tests, setting a variable to see if anything was found or not



      found=0
      if [ -f "$LaunchDaemon" ]
      then
      echo $LaunchDaemon found
      found=1
      fi
      if [ -f "$launchAgent" ]
      then
      echo $launchAgent found
      found=1
      fi
      ...
      if [ $found == 0 ]
      then
      echo Not found
      fi


      Now sometimes we want to set a variable so we know which one was found. This is common when trying to find a matching program or file (eg in the old days we might have had /usr/lib/sendmail or /usr/sbin/sendmail depending on the OS distribution, so we'd need to search to find it).



      found=
      for f in "$LaunchDaemon" "$launchAgent" "$mobileLaunchDaemon" "$mobileAgent"
      do
      [[ -f "$f" ]] && found="$f"
      done


      Now we have $found pointing to a found entry and can test on that.



      if [ -n "$found" ]
      then
      echo Found: $found
      else
      echo Nothing found
      fi


      The second loop can also find all versions with a minor change:



      found=
      for f in "$LaunchDaemon" "$launchAgent" "$mobileLaunchDaemon" "$mobileAgent"
      do
      [[ -f "$f" ]] && found="$found $f"
      done


      The downside of this is that there may be a leading space in front, so we should remove that:



      found="${found# }"





      share|improve this answer





















      • +1. BTW, a minor modification of that final for loop can be used to choose a file to use from one of several dirs - e.g. for d in /etc/program /usr/share/program /usr/local/etc ~/.program ; do [ -e "$d/conf" ] && configfile="$d/conf" ; done; [ -z "$configfile" ] && echo "no config found" && exit 1 - the last one found will be used, so dirs are in order from lowest to highest priority.
        – cas
        Aug 4 '16 at 5:03













      up vote
      3
      down vote



      accepted







      up vote
      3
      down vote



      accepted






      You need to split your if test into multiple



      if [ -f "$LaunchDaemon" ]
      then
      echo $LaunchDaemon found
      elif [ -f "$launchAgent" ]
      then
      echo $launchAgent found
      elif [ ...
      ...
      else
      echo Not found
      fi


      type structure (fill in the blanks yourself.).



      If you want to find all matches just do it as multiple tests, setting a variable to see if anything was found or not



      found=0
      if [ -f "$LaunchDaemon" ]
      then
      echo $LaunchDaemon found
      found=1
      fi
      if [ -f "$launchAgent" ]
      then
      echo $launchAgent found
      found=1
      fi
      ...
      if [ $found == 0 ]
      then
      echo Not found
      fi


      Now sometimes we want to set a variable so we know which one was found. This is common when trying to find a matching program or file (eg in the old days we might have had /usr/lib/sendmail or /usr/sbin/sendmail depending on the OS distribution, so we'd need to search to find it).



      found=
      for f in "$LaunchDaemon" "$launchAgent" "$mobileLaunchDaemon" "$mobileAgent"
      do
      [[ -f "$f" ]] && found="$f"
      done


      Now we have $found pointing to a found entry and can test on that.



      if [ -n "$found" ]
      then
      echo Found: $found
      else
      echo Nothing found
      fi


      The second loop can also find all versions with a minor change:



      found=
      for f in "$LaunchDaemon" "$launchAgent" "$mobileLaunchDaemon" "$mobileAgent"
      do
      [[ -f "$f" ]] && found="$found $f"
      done


      The downside of this is that there may be a leading space in front, so we should remove that:



      found="${found# }"





      share|improve this answer












      You need to split your if test into multiple



      if [ -f "$LaunchDaemon" ]
      then
      echo $LaunchDaemon found
      elif [ -f "$launchAgent" ]
      then
      echo $launchAgent found
      elif [ ...
      ...
      else
      echo Not found
      fi


      type structure (fill in the blanks yourself.).



      If you want to find all matches just do it as multiple tests, setting a variable to see if anything was found or not



      found=0
      if [ -f "$LaunchDaemon" ]
      then
      echo $LaunchDaemon found
      found=1
      fi
      if [ -f "$launchAgent" ]
      then
      echo $launchAgent found
      found=1
      fi
      ...
      if [ $found == 0 ]
      then
      echo Not found
      fi


      Now sometimes we want to set a variable so we know which one was found. This is common when trying to find a matching program or file (eg in the old days we might have had /usr/lib/sendmail or /usr/sbin/sendmail depending on the OS distribution, so we'd need to search to find it).



      found=
      for f in "$LaunchDaemon" "$launchAgent" "$mobileLaunchDaemon" "$mobileAgent"
      do
      [[ -f "$f" ]] && found="$f"
      done


      Now we have $found pointing to a found entry and can test on that.



      if [ -n "$found" ]
      then
      echo Found: $found
      else
      echo Nothing found
      fi


      The second loop can also find all versions with a minor change:



      found=
      for f in "$LaunchDaemon" "$launchAgent" "$mobileLaunchDaemon" "$mobileAgent"
      do
      [[ -f "$f" ]] && found="$found $f"
      done


      The downside of this is that there may be a leading space in front, so we should remove that:



      found="${found# }"






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Aug 3 '16 at 13:07









      Stephen Harris

      23k24176




      23k24176












      • +1. BTW, a minor modification of that final for loop can be used to choose a file to use from one of several dirs - e.g. for d in /etc/program /usr/share/program /usr/local/etc ~/.program ; do [ -e "$d/conf" ] && configfile="$d/conf" ; done; [ -z "$configfile" ] && echo "no config found" && exit 1 - the last one found will be used, so dirs are in order from lowest to highest priority.
        – cas
        Aug 4 '16 at 5:03


















      • +1. BTW, a minor modification of that final for loop can be used to choose a file to use from one of several dirs - e.g. for d in /etc/program /usr/share/program /usr/local/etc ~/.program ; do [ -e "$d/conf" ] && configfile="$d/conf" ; done; [ -z "$configfile" ] && echo "no config found" && exit 1 - the last one found will be used, so dirs are in order from lowest to highest priority.
        – cas
        Aug 4 '16 at 5:03
















      +1. BTW, a minor modification of that final for loop can be used to choose a file to use from one of several dirs - e.g. for d in /etc/program /usr/share/program /usr/local/etc ~/.program ; do [ -e "$d/conf" ] && configfile="$d/conf" ; done; [ -z "$configfile" ] && echo "no config found" && exit 1 - the last one found will be used, so dirs are in order from lowest to highest priority.
      – cas
      Aug 4 '16 at 5:03




      +1. BTW, a minor modification of that final for loop can be used to choose a file to use from one of several dirs - e.g. for d in /etc/program /usr/share/program /usr/local/etc ~/.program ; do [ -e "$d/conf" ] && configfile="$d/conf" ; done; [ -z "$configfile" ] && echo "no config found" && exit 1 - the last one found will be used, so dirs are in order from lowest to highest priority.
      – cas
      Aug 4 '16 at 5:03












      up vote
      1
      down vote













      An array would be the best approach here



      #!/bin/bash
      #Store the filenames in an array, also less management overhead
      arry=( "LaunchDaemon.plist" "LaunchAgent" "MobileDaemon.plist" "MobileAgent" )
      #Optioinally if you wish to add one more file to check you could
      #uncomment the below line
      #arry+=("$1") #One more file added from the command line
      for i in "${arry[@]}" #Iterate through each element using a for loop
      do
      if [ -f "$i" ]
      then
      echo "<result> $i Found</result>"
      else
      echo "<result> $i Not Found</result>"
      fi
      done





      share|improve this answer



























        up vote
        1
        down vote













        An array would be the best approach here



        #!/bin/bash
        #Store the filenames in an array, also less management overhead
        arry=( "LaunchDaemon.plist" "LaunchAgent" "MobileDaemon.plist" "MobileAgent" )
        #Optioinally if you wish to add one more file to check you could
        #uncomment the below line
        #arry+=("$1") #One more file added from the command line
        for i in "${arry[@]}" #Iterate through each element using a for loop
        do
        if [ -f "$i" ]
        then
        echo "<result> $i Found</result>"
        else
        echo "<result> $i Not Found</result>"
        fi
        done





        share|improve this answer

























          up vote
          1
          down vote










          up vote
          1
          down vote









          An array would be the best approach here



          #!/bin/bash
          #Store the filenames in an array, also less management overhead
          arry=( "LaunchDaemon.plist" "LaunchAgent" "MobileDaemon.plist" "MobileAgent" )
          #Optioinally if you wish to add one more file to check you could
          #uncomment the below line
          #arry+=("$1") #One more file added from the command line
          for i in "${arry[@]}" #Iterate through each element using a for loop
          do
          if [ -f "$i" ]
          then
          echo "<result> $i Found</result>"
          else
          echo "<result> $i Not Found</result>"
          fi
          done





          share|improve this answer














          An array would be the best approach here



          #!/bin/bash
          #Store the filenames in an array, also less management overhead
          arry=( "LaunchDaemon.plist" "LaunchAgent" "MobileDaemon.plist" "MobileAgent" )
          #Optioinally if you wish to add one more file to check you could
          #uncomment the below line
          #arry+=("$1") #One more file added from the command line
          for i in "${arry[@]}" #Iterate through each element using a for loop
          do
          if [ -f "$i" ]
          then
          echo "<result> $i Found</result>"
          else
          echo "<result> $i Not Found</result>"
          fi
          done






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 3 '16 at 13:21

























          answered Aug 3 '16 at 13:15









          sjsam

          1,1551919




          1,1551919






















              up vote
              0
              down vote













              try this



              #!/bin/bash
              search_LaunchDaemon="LaunchDaemon.plist"
              search_launchAgent="LaunchAgent"
              search_mobileLaunchDaemon="MobileDaemon.plist"

              for filex in ${!search_*}
              do
              found=${!filex}
              #echo -e "${filex}=${!filex}"
              #we remove the prefix "search_"
              IFS="_" read part1 part2 <<< "${filex}"

              if [[ -f $found ]];
              then
              echo "I have found ${part2}"
              else
              echo "${part2} not found!"
              fi
              done





              share|improve this answer

























                up vote
                0
                down vote













                try this



                #!/bin/bash
                search_LaunchDaemon="LaunchDaemon.plist"
                search_launchAgent="LaunchAgent"
                search_mobileLaunchDaemon="MobileDaemon.plist"

                for filex in ${!search_*}
                do
                found=${!filex}
                #echo -e "${filex}=${!filex}"
                #we remove the prefix "search_"
                IFS="_" read part1 part2 <<< "${filex}"

                if [[ -f $found ]];
                then
                echo "I have found ${part2}"
                else
                echo "${part2} not found!"
                fi
                done





                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  try this



                  #!/bin/bash
                  search_LaunchDaemon="LaunchDaemon.plist"
                  search_launchAgent="LaunchAgent"
                  search_mobileLaunchDaemon="MobileDaemon.plist"

                  for filex in ${!search_*}
                  do
                  found=${!filex}
                  #echo -e "${filex}=${!filex}"
                  #we remove the prefix "search_"
                  IFS="_" read part1 part2 <<< "${filex}"

                  if [[ -f $found ]];
                  then
                  echo "I have found ${part2}"
                  else
                  echo "${part2} not found!"
                  fi
                  done





                  share|improve this answer












                  try this



                  #!/bin/bash
                  search_LaunchDaemon="LaunchDaemon.plist"
                  search_launchAgent="LaunchAgent"
                  search_mobileLaunchDaemon="MobileDaemon.plist"

                  for filex in ${!search_*}
                  do
                  found=${!filex}
                  #echo -e "${filex}=${!filex}"
                  #we remove the prefix "search_"
                  IFS="_" read part1 part2 <<< "${filex}"

                  if [[ -f $found ]];
                  then
                  echo "I have found ${part2}"
                  else
                  echo "${part2} not found!"
                  fi
                  done






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 3 '17 at 15:13









                  Talal

                  1032




                  1032






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f300030%2fhow-do-i-show-the-results-found-in-an-if-then-statement%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Accessing regular linux commands in Huawei's Dopra Linux

                      Can't connect RFCOMM socket: Host is down

                      Kernel panic - not syncing: Fatal Exception in Interrupt