jeudi 24 novembre 2016

How to write complex if in ksh

I dont often use ksh and I dont know how to write this :

if variable is empty or variable equals "no rows selected"

I tried :

if [[ -z "${NUMCARSAT}" -o "$NUMCARSAT" | tr -s " " == "no rows selected" ]]

error = syntax error '-o' unexpected


if [ -z "${NUMCARSAT}" -o "$NUMCARSAT" | tr -s " " = "no rows selected" ]

error =  test: ] missing
Usage: tr [ [-c|-C] | -[c|C]ds | -[c|C]s | -ds | -s ] [-A] String1 String2
   tr { -[c|C]d | -[c|C]s | -d | -s } [-A] String1

Can somebody give me the right if to write down

Thank you

Aucun commentaire:

Enregistrer un commentaire