4 ms·
I... don't understand. I thought the whole reason for using [[ and breaking posix compatibility was to prevent just this kind of vulnerability. Why would bash d
by webstrand 2y ago
I... don't understand. I thought the whole reason for using [[ and breaking posix compatibility was to prevent just this kind of vulnerability. Why would bash do this.
- deleted 2y ago[deleted]
- oneshtein 2y agoInstead of `if [[ "${num}" -eq 42 ]]`, bash expects `if [ "${num}" -eq 42 ]` or `if (( num==42 ))`.
- tpoacher 2y agoor if test $num -eq 42, which is the most sensible way to do it in my view, since it really makes the point clear that what you're really evaluating is the exit status of the evaluated command (and where '[' is simply an alias to 'test')
- jwilk 2y ago"if (( num==42 ))" can exectue code from $num too.
- Leynos 2y agoTypeset num as an integer.