Answer the question
In order to leave comments, you need to log in
Linux can't count to 10?
Today I encountered a very strange thing
. The essence of the task was quite simple to throw sharp spikes in the number of letters in the queue into the monitoring system.
I quickly threw in the rule test "99" \> "$(mailq|wc -l)"; echo $?
, in fact, it is a little more complicated there, but this does not change the essence.
And so the chip is in what
If $(mailq|wc -l)
= "15", then the calculation will work correctly BUT only before the appearance of a new register 100 will already issue a status 0
or if you change the sign in the other direction, then 1
but not from the numbers
1000 and so on the same
Actually we check the value variable
[email protected] ~ $ mailq|wc -l
49971
[email protected] ~ $ test "99" \> "$(mailq|wc -l)"; echo $?
0
[email protected] ~ $ test "9999" \> "$(mailq|wc -l)"; echo $?
0
[email protected] ~ $ test "99999" \> "$(mailq|wc -l)"; echo $?
0
[email protected] ~ $ test "999999" \> "$(mailq|wc -l)"; echo $?
0
[email protected] ~ $ test "999999" \< "$(mailq|wc -l)"; echo $?
1
[email protected] ~ $ test "99999" \< "$(mailq|wc -l)"; echo $?
1
[email protected] ~ $ test "9999" \< "$(mailq|wc -l)"; echo $?
1
[email protected] ~ $ test "999" \< "$(mailq|wc -l)"; echo $?
1
[email protected] ~ $ test "99" \< "$(mailq|wc -l)"; echo $?
1
[email protected] ~ $ test "9" \< "$(mailq|wc -l)"; echo $?
1
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question