Kyowash wrote: ⤴
Thu Mar 29, 2018 11:34 am
My question is: is it really
Depends on one's frame of reference I'd say. If you're an advanced bash programmer, used to its arithmetic expressions, then I can imagine that "translating" simple generic arithmetic into special purpose test expressions seems pointless. Writing
if ((number > 0))
would also feel more natural to, say, a C programmer used to
if (number > 0)
. Conversely, a reason why some might prefer the "test" syntax is that, if you'd use single
, the test variant is in fact POSIX.
If you try doing actual, serious programming in bash you almost without fail run into its limitations; I as such more often than not feel bash is needlessly complex; that 90% of its features could be slashed without impacting more than 10% of users. I.e., if for serious work you need something else anyway
than why bother with all the complexity in the first place? Arithmetic expressions would be part of that which could in that view be slashed, meaning that if I were consistent I'd prefer the test syntax.
I am of course not and prefer the arithmetic syntax -- and would generally feel often handicapped without it on the command line, but still. The answer to your specific question I would believe to be "use whatever you prefer". Bash is I feel not to be considered useful for serious programming anyway, so no pressing reason to become autistically attached to any of its features or syntax either. <shrug>.