I have found this in an old script but can't tell what is the use of the "x" infront of the ${VARIABLE} and infront of the value "onx" being compared

if [ "${VARIABLE}x" != "onx" ]

Are there any effects if the x is removed?

  • 1
    It's not needed with proper quoting (which you have) and a vaguely modern shell (which you probably also have), so go ahead and remove it. See this stackoverflow question. – Gordon Davisson Feb 16 at 7:51
  • In any modern shell, or at least in bash, there will be no difference to the outcome of the test if x is removed. See the dupe questions. – Kusalananda Feb 16 at 7:51
  • It's also not needed because of the preceding line that sets VARIABLE to a value if it's either unset or empty. Since now VARIABLE cannot be empty the x guard isn't required – roaima Feb 16 at 8:40