@michaelk - I find the following to be a curious statement:
Quote:
Essentially bash variables are strings.
|
I am not sure how you came up with this?
Allow me to demonstrate why I think it is incorrect:
Code:
$ cat string_and_num_test.sh
#!/bin/bash
s='100'
n=100
[[ $x < "12" ]] && echo true for string
(( n < 12 )) && echo true for num
$ ./string_and_num_test.sh
true for string
We see the test works for the string as characters are compared from left to right however the number test clearly shows that it is being calculated as a number.
Now unless bash does some magic to number tests compared to string ones I would say you can have both string and numerical variables.