14

Bash: integer expression expected, using read/test

view full story
linux-howto

http://unix.stackexchange.com – I'm learning the basics of shell programming, so I wrote something simple like #!/bin/bash read var1 read var2 if [ var1 -lt var2 ]; then echo "var1 is lt var2" else echo "var2 is lt var1" fi My understanding is that variables are untyped in Bash, and that any variable may be used as an integer if it only contains digits. But I get the error "integer expression expected" when I run this... why? (HowTos)