Just want to know what is the below command do, or what -f means
if [ -f ${PDFFOLDER}/*.pdf ]; then
rm ${PDFFOLDER}/*.pdf
fi
Since [ ] and test aree the same command, the expressions within [ ] can be found in man test:
NAME
test - check file types and compare values
SYNOPSIS
test EXPRESSION
test
[ EXPRESSION ]
[ ]
[ OPTION
And there you also see:
-f FILE
FILE exists and is a regular file
So if [ -f "$file" ]; then... means: if the file $file exists and is a regular file (that is, not a directory or device file), then do whatever.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With