A voir également:
- Bash: erreur de syntaxe près du symbole inattendu « newline »
- Numéro symbole ✓ - Forum Word
- Numero symbole ✓ - Forum Bureautique
- Symbole poisson voiture - Accueil - Maison
- Instagram connexion impossible erreur inattendue ✓ - Forum Instagram
- Symbole attention word ✓ - Forum Word
3 réponses
Remarque ton nom de variable exists n'est pas très heureux (ressemble au mot-clé exit. Utilide plutôt des noms en UPPERCASE_WITH_UNDERSCORES
Ceci dit,
Pour ton test, ton utilisation est erronée , examine ceci:
johand@bata:~$ unset truc
johand@bata:~$ if [ -z $truc ] ; then echo BAD; fi
BAD
johand@bata:~$ if [ -z = "$truc" ] ; then echo BAD; fi
johand@bata:~$ truc=123
johand@bata:~$ if [ -z $truc ] ; then echo BAD; fi ; echo OK
OK
[ -z = $BLAH ] retourne toujours faux !
En outre, et c'est le plus important, le corps du else est vide ce qui fournit une erreur. Supprime cette branche ou mets-y une instruction valide.
exemple:
Gates gave ^W sold you the windows.
GNU gave us the whole house.(Alexandrin)
Ceci dit,
Pour ton test, ton utilisation est erronée , examine ceci:
johand@bata:~$ unset truc
johand@bata:~$ if [ -z $truc ] ; then echo BAD; fi
BAD
johand@bata:~$ if [ -z = "$truc" ] ; then echo BAD; fi
johand@bata:~$ truc=123
johand@bata:~$ if [ -z $truc ] ; then echo BAD; fi ; echo OK
OK
[ -z = $BLAH ] retourne toujours faux !
En outre, et c'est le plus important, le corps du else est vide ce qui fournit une erreur. Supprime cette branche ou mets-y une instruction valide.
exemple:
#!/bin/sh if [ -z $1 ] ; then echo "No param" else # TTT echo "Param1 is $1" fi
Gates gave ^W sold you the windows.
GNU gave us the whole house.(Alexandrin)