Wait (the end of N process in ksh and after run an

2019-09-21 10:03发布

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条回答
神经病院院长
2楼-- · 2019-09-21 10:55

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)

查看更多
登录 后发表回答