Quantcast
Channel: conditional find output missing - Ask Ubuntu
Browsing index pages (3 articles)
↧

conditional find output missing

Im trying to build a conditional statement to search for files of a certain size (in this case 1Gb. if [ "find /location/sub/int/ -size +1G" ] then > /location/sub/int/large_file_audit.txt fi I run...

View Article


Answer by Ravexina for conditional find output missing

One liner workaround: find -size +10G | grep ".*" > file.log || (rm file.log; echo "Can't find anything") Or: find -size +10G | grep ".*" > file.log || rm file.log Note that find returns 1...

View Article


Answer by steeldriver for conditional find output missing

Your test if [ "find /location/sub/int/ -size +1G" ] doesn't work the way you intend because it tests the non-emptiness of the string "find /location/sub/int/ -size +1G" - which will always be true. In...

View Article
Browsing index pages (3 articles)


Latest Images