Pourquoi ce script exécution de la chaîne dans l'instruction if:Pourquoi la valeur de cette chaîne, dans un script bash, est-elle en cours d'exécution?
#!/bin/bash
FILES="*"
STRING=''
for f in $FILES
do
if ["$STRING" = ""]
then
echo first
STRING='hello'
else
STRING="$STRING hello"
fi
done
echo $STRING
lorsqu'il est exécuté avec sh script.sh
sorties:
first
lesscd.sh: line 7: [hello: command not found
lesscd.sh: line 7: [hello hello: command not found
lesscd.sh: line 7: [hello hello hello: command not found
lesscd.sh: line 7: [hello hello hello hello: command not found
lesscd.sh: line 7: [hello hello hello hello hello: command not found
hello hello hello hello hello hello
P.S. première tentative d'un script shell
grâce
merci. je vais apprendre le rubis à la place:) – Ross