1

Voila, je suis sous cygwin, en utilisant le shell Bash...

qd je tape une condition du style
if [[ $a -eq 10 ]]
sous "ligne de commande", ça passe..
mais qd je la met dans un fichier, ça foire sad



voila une "capture d'écran" :

Pascal@MARTIN_P ~
$ cd tests

Pascal@MARTIN_P ~/tests
$ ll
total 0
drwxrwxrwx+   2 Pascal   Aucun           0 Mar  2 00:10 .
drwxrwxrwx+  12 Pascal   Aucun           0 Mar  2 00:10 ..

Pascal@MARTIN_P ~/tests
$ vi test

Pascal@MARTIN_P ~/tests
$ ll
total 1
drwxrwxrwx+   2 Pascal   Aucun           0 Mar  2 00:11 .
drwxrwxrwx+  12 Pascal   Aucun           0 Mar  2 00:10 ..
-rw-rw-rw-    1 Pascal   Aucun         105 Mar  2 00:11 test

Pascal@MARTIN_P ~/tests
$ chmod 700 test

Pascal@MARTIN_P ~/tests
$ ll
total 1
drwxrwxrwx+   2 Pascal   Aucun           0 Mar  2 00:11 .
drwxrwxrwx+  12 Pascal   Aucun           0 Mar  2 00:10 ..
-rwx------    1 Pascal   Aucun         105 Mar  2 00:11 test

Pascal@MARTIN_P ~/tests
$ cat tests
cat: tests: No such file or directory

Pascal@MARTIN_P ~/tests
$ cat test
echo "Entrez une valeur :\c"
read a
if [[ $a -eq 10 ]]
then
        echo "c'est 10 !!!"
else
        echo "Pas 10"
fi


Pascal@MARTIN_P ~/tests
$ ./test
Entrez une valeur :\c
10
[[: not found
Pas 10

Pascal@MARTIN_P ~/tests
$ echo "valeur ?\c";  read b;   if [[ b -eq 10 ]]
> then
> echo "C'est 10"
> else
> echo "pas 10"
> fi
valeur ?\c
10
C'est 10

Pascal@MARTIN_P ~/tests
$


je n'ai pas oublié de faire un chmod 700 sur mon script afin de le rendre exécutable...
(son contenu est affiché à un moment par cat, histoire de voir que c en gros la même chose que ce que je saisi (et qui marche) sous la ligne de cmd...)

Vous sauriez pas comment je peux corriger ça ?
avatar
Tutorial C (TI-89/92+/v200) - Articles Développement Web (PHP, Javascript, ...)
« What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against? » - Larry Wall

2

répondu sur IRC happy
avatar
Webmaster et développeur du site. Pour tout probleme ou question envoyez un mini message ou mail.

Suivez l'actualité de tous vos site préférés sur yAronews : http://ns.yaronet.com =)

3

bon, yAro m'a dit de rajouter au début la ligne

#! /bin/bash

(enfin, le chemin correspondant, selon l'install)

et ça marche smile

merci yAro smile


(en attendant, le topic servira peut-être à d'autre... espérons que g pas posté pr rien smile)
avatar
Tutorial C (TI-89/92+/v200) - Articles Développement Web (PHP, Javascript, ...)
« What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against? » - Larry Wall