if [[ -s log.txt ]];
What does -s mean? I know -z means zero sized string. I cannot find any documentation on -s.
What does [] or [[]] mean, while writing an if condition. I have used if without [] or [[]] and it worked fine.
if [[ -s log.txt ]];
What does -s mean? I know -z means zero sized string. I cannot find any documentation on -s.
What does [] or [[]] mean, while writing an if condition. I have used if without [] or [[]] and it worked fine.
The -s test returns true if
[...] if file exists and has a size greater than zero
This is documented in the bash manual, and also in the manual for the test utility (the test may also be written if test -s file; then).
For [ ... ] and [[ ... ]], see: Bash - If Syntax confusion
-s FILE:- FILE exists and has a size greater than zero.
The [[ ... ]] part allows to test a condition using operators. Think of it as an if statement. In your example, you're using the -s operator, which tests that the referenced file is not empty.