Aren't bash script variable untyped (converted automatically)? -
touch "data" if [ $(stat -c%s "data") < 1024 ]; echo "not file" fi it cannot check whether file size less 1mib. (of course, data should empty file.)
it give error:
./chk.sh: line 2: 1024: no such file or directory aren't bash script variable untyped (converted automatically)?
you should using -lt instead of < integer comparison
= , != used string comparisons
< , > used redirection
Comments
Post a Comment