Salut, Quelqu'un pourrait m'aider?
Je suis en train de compiler un script bash, j'utilise le shell bash du cygwin mais apparemment le shell ne compile pas la sentence if, le code est le suivant:
si je met en commentaires le if, ça marche. J'ai déjà essayé avec des scripts d'exemple et c'est pareil, le shell ne trouve pas la syntaxe du if.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 #!/bin/bash TASK="EX" LIBS="date_time.gra number.gra next.gra" PHOENIX=../.. SingleFile=0 # if separate files, pack into single file if [ $SingleFile -eq 0 ] then # if file exists, save it as *.old if [ -e $TASK.gra ] then mv $TASK.gra $TASK.gra.old fi cat *.gra > xxx mv xxx $TASK.gra fi # append lib grammars to file cd $PHOENIX/Grammars/ cat $LIBS >> ../Example/Grammar/$TASK.gra cd ../Example/Grammar/ echo $pwd # remove old compiled files rm base.dic rm nets rm log rm $TASK.net # create list of nets to be compiled cat $TASK.gra | $PHOENIX/Scripts/mk_nets.perl > nets # compile grammar output messages to file "log" echo "compiling grammar" $PHOENIX/ParserLib/compile_grammar.c -f $TASK > log grep ERROR log grep WARN log # flag leaf nodes for extracts function echo "flagging leaf nodes" $PHOENIX/ParserLib/concept_leaf.c -grammar $TASK.net
Merci
**********************************
Merci al1_24, j'ai lu le man sh comme tu m'a dit et apparement la syntax c'est bonne, mais l'interpreteur bash m'indique un erreur de syntax dans les expressions conditionnelles, comme j'ai déjà dit, j'ai cherche dans le man sh est la syntax c'est correcte, je n'ai sais pas si c'est à cause du cygwin, peut-être il manque un package?
Partager