Skip to main content
deleted 120 characters in body
Source Link
John WH Smith
  • 16.5k
  • 6
  • 54
  • 63

How can I use the result of a find command in an if statement and compare with true or false?

Something like this:

    if [ `find . -name test.txt -size 156c`="true" ]; then echo Found; fi

This is the whole script:

      1 #!/bin/bash
      2 if [ $# -ne 2 ]
      3 then
      4         echo Not enough params
      5         
      6 fi
      7 
      8 if [ `find . -name $1 -size $2c | grep -q .` -eq 0 ]
      9 then
      10         echo OK
      11 fi  

How can I use the result of a find command in an if statement and compare with true or false?

Something like this:

    if [ `find . -name test.txt -size 156c`="true" ]; then echo Found; fi

This is the whole script:

      1 #!/bin/bash
      2 if [ $# -ne 2 ]
      3 then
      4         echo Not enough params
      5         
      6 fi
      7 
      8 if [ `find . -name $1 -size $2c | grep -q .` -eq 0 ]
      9 then
      10         echo OK
      11 fi  

How can I use the result of a find command in an if statement and compare with true or false?

Something like this:

if [ `find . -name test.txt -size 156c`="true" ]; then echo Found; fi

This is the whole script:

#!/bin/bash
if [ $# -ne 2 ]
then
    echo Not enough params
fi

if [ `find . -name $1 -size $2c | grep -q .` -eq 0 ]
then
    echo OK
fi  
added 332 characters in body
Source Link
ABC
  • 229
  • 1
  • 3
  • 7

How can I use the result of a find command in an if statement and compare with true or false?

Something like this:

    if [ `find . -name test.txt -size 156c`156c`="true" ]; then echo Found; fi

This is the whole script:

      1 #!/bin/bash
      2 if [ $# -ne 2 ]
      3 then
      4         echo Not enough params
      5         
      6 fi
      7 
      8 if [ `find . -name $1 -size $2c | grep -q .` -eq "true"0 ];]
      9 then
      10         echo Found;OK
      11 fi  

How can I use the result of a find command in an if statement and compare with true or false?

Something like this:

if [ `find . -name test.txt -size 156c` -eq "true" ]; then echo Found; fi

How can I use the result of a find command in an if statement and compare with true or false?

Something like this:

    if [ `find . -name test.txt -size 156c`="true" ]; then echo Found; fi

This is the whole script:

      1 #!/bin/bash
      2 if [ $# -ne 2 ]
      3 then
      4         echo Not enough params
      5         
      6 fi
      7 
      8 if [ `find . -name $1 -size $2c | grep -q .` -eq 0 ]
      9 then
      10         echo OK
      11 fi  

How can I use the result of a find command in an if statement toand compare with true or false  ? Something

Something like thatthis:

    if [ `find . -name test.txt -size 156c` -eq "true" ]; then echo Found; fi

How can I use the result of a find command in an if statement to compare with true or false  ? Something like that:

    if [ `find . -name test.txt -size 156c` -eq "true" ]; then echo Found; fi

How can I use the result of a find command in an if statement and compare with true or false?

Something like this:

if [ `find . -name test.txt -size 156c` -eq "true" ]; then echo Found; fi
added 4 characters in body
Source Link
ABC
  • 229
  • 1
  • 3
  • 7
Loading
Source Link
ABC
  • 229
  • 1
  • 3
  • 7
Loading