Post #821484
2026-02-09 20:54 UTC
TIL: test -s exists - an easy way to check for non-empty files in bash scripts.
Nothing new, nothing sensational but comes in quite handy sometimes when just need to know is there any content in file X.
E.g.:
if [ -s /path/to/some/file ]; then
echo "the file is not empty"
fi
#bash #shell
Replies (0)
No replies.