问题
my script is:
#!/bin/ksh
WORKFLOW1=wf_m_LOAD_ODS_DMT_FATTO_E_BSN_LETTURE_F
WORKFLOW2=wf_m_LOAD_ODS_DMT_FATTO_E_ANAGRAFICA_POD_F
WORKFLOW3=wf_m_LOAD_ODS_DMT_FATTI_E_QF_F
pmcmd startworkflow -sv $SERVER -d $DOMINIO -u $USER -p $PASSWD -f $DIRECTORY_SEC_LEV_ELE $WORKFLOW1 & pmcmd startworkflow -sv $SERVER -d $DOMINIO -u $USER -p $PASSWD -f $DIRECTORY_SEC_LEV_ELE $WORKFLOW2 & pmcmd startworkflow -sv $SERVER -d $DOMINIO -u $USER -p $PASSWD -f $DIRECTORY_SEC_LEV_ELE $WORKFLOW3 &;
wait;
echo "Lancio creazione indici T_DMT_SEE_FT_BSN_LETTURE">>log_DMT_R1.log
sqlplus $USERDBDMT/$PASSDBDMT@$SIDDB @create_index_T_DMT_SEE_FT_BSN_LETTURE.sql &
I have error:
./Start_lancio_unico_ELE_DMT_INFASAMENTO_FT.sh: line 27: syntax error near unexpected token `;'
./Start_lancio_unico_ELE_DMT_INFASAMENTO_FT.sh: line 27: `pmcmd startworkflow -sv $SERVER -d $DOMINIO -u $USER -p $PASSWD -f $DIRECTORY_SEC_LEV_ELE $WORKFLOW1 &;'
why ; is not correct?
i want run 3 process in background and after they are finished run a 3th process.
thanks to all
回答1:
It appears that's a bash error, not a ksh error. How are you invoking the script?
$ cat script.sh
#!/usr/bin/ksh
sleep 5 &;
wait;
echo done
$ ksh script.sh
done
$ bash script.sh
script.sh: line 2: syntax error near unexpected token `;'
script.sh: line 2: `sleep 5 &;'
In bash, both &
and ;
are command terminators, and it's apparently an error to use both. Ref: http://www.gnu.org/software/bash/manual/bashref.html#Lists
A
list
is a sequence of one or more pipelines separated by one of the operators ‘;’, ‘&’, ‘&&’, or ‘||’, and optionally terminated by one of ‘;’, ‘&’, or a newline.
(emphasis mine)
来源:https://stackoverflow.com/questions/23113267/wait-the-end-of-n-process-in-ksh-and-after-run-another-process-dont-work-corre