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

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -