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
Aucun commentaire:
Enregistrer un commentaire