You are viewing a single comment's thread. Return to all comments →
Brace expansion is resolved first by bash. since x,y can be negative, I put y in parentheses so as to distinguish the - sign and the comparison operator. the brace expansion produces X>Y, X==Y, X<Y. You need to escape the operators. printf with "%s\n" returns the above strings separated by newline. These strings are passed to bc which evaluates and returns the comparison results. The outer parentheses converts the results returned by bc into an array.
Seems like cookies are disabled on this browser, please enable them to open this website
Comparing Numbers
You are viewing a single comment's thread. Return to all comments →