There is a substraction operation that results in an error, however it seems there are two operands given:

PREV="$(intranet -r)"
PREV=${PREV/Revision: /}      ## results in "11072"
REV="$(intranet -r)"
REV=${REV/Revision: /}     ## results in "11072"
RDIFF=$(( ${REV} - ${PREV} ))        ## throws error

/usr/local/bin/updateAll: line 36: 11072 - 11072 : syntax error: operand expected (error token is "11072 - 11072 ")

I tried putting REV/PREV in "brackets" and without "$" with no success.

EDIT: The actual result of

intranet -r | sed -n l


\033[96mRevision: 11072$


(Because the output is color-formatted)

closed as off-topic by tripleee, don_crissti, G-Man, DarkHeart, thrig Apr 29 '17 at 3:48

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – tripleee, don_crissti, G-Man, DarkHeart, thrig
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    What is the actual output of intranet -r? – Kusalananda Apr 28 '17 at 13:56
  • It outputs: "Revision: 11072" (without brackets) – xcy7e Apr 28 '17 at 13:57
  • More like intranet -r | sed -n l (same with -u). – Stéphane Chazelas Apr 28 '17 at 13:57
  • I assume there could be a " " (space) after the digit in final $REV. Would that be a problem? Do you have an idea of how to trim that digit-string? – xcy7e Apr 28 '17 at 14:01
  • 2
    I see the same error with bash -c $'echo $(( \u200b11072 - 11072 ))' or bash -c $'echo $(( \a11072 - 11072 ))'. I'd bet the output has some invisible characters. – Stéphane Chazelas Apr 28 '17 at 14:05

Sorry, the problem was the color formatting. I added a second case "intranet -R" (uppercase "R") without color formatting - works like a charm.

Thank you for digging your heads in and sorry for bothering!

Not the answer you're looking for? Browse other questions tagged or ask your own question.