Monday, 15 March 2010

Aren't bash script variable untyped (converted automatically)? -


  touch "data" if [$ (stat -c% s "data") & lt; 1024]; Then "Encrypt file" file  

can not verify that the file size is less than 1MiB or not (of course, data is empty File.)

This will return the error:

  ./ chk.sh: line 2: 1024: No such file or directory  < / Pre> 

Whether the script variable is not included (automatically converted?)

For integer comparison & lt; Instead of you should use -lt

= and ! = string is used for comparison

& lt; and & gt; is used for redirection


No comments:

Post a Comment