开发者

Shell script exiting the loop after calling another script

开发者 https://www.devze.com 2023-02-04 13:11 出处:网络
I have a shell script s1 calling another script s2 in a loop. However s1 can not seem to continue the loop after s2 returns.

I have a shell script s1 calling another script s2 in a loop.

However s1 can not seem to continue the loop after s2 returns.

Commenting out the line that calls s2 will enable the loop to continue.

s2 does copy of one file, s1 checks conditions and copy several files using s2.

Can anyone give a pointer what is going on here?

...
while read line
do
    s2 param1 param2 param3
    echo "copy done"
done < $tempfile

echo "out of loop"
...

"copy done" is printed, so is "out of loop"

So开发者_如何转开发me contents in s2:

if ls -l $LOGDIR | grep -w sftp.log

if ssh $USER -i $IDENTITY "ls -l $MOV_LOC"

cat $TMPDIR/$TMPFILE1 | /usr/xpg4/bin/awk -v logdir=$LOGDIR -v register=$REGISTER -v rmt_cmd=$RMT_CMD -v identity=$IDENTITY '{print "scp -q -r -P 22 -i", identity, rmt_cmd ,$NF, ">>" , logdir "/" register , "2>&1"}' > $TMPDIR/$TMPSCRIPT2

cat $TMPDIR/$TMPFILE1 | /usr/xpg4/bin/awk -v tmpdir=$TMPDIR -v list=$TMPFILE2 '{print "digest -a sha1" , $NF , ">>", tmpdir "/" list}' > $TMPDIR/$TMPSCRIPT1

ssh $USER -i $IDENTITY "mv $REMOTE_QUEUE $MOV_LOC" > $TMPDIR/$TMPFILE5


Somewhere within s2 you have a command that is consuming stdin and therefore the redirection from $tempfile. Without seeing its contents we can't help further.

0

精彩评论

暂无评论...
验证码 换一张
取 消