2013-11-04 2 views
-1

메신저로 루프 스크립트를 만들려고 시도하지만 그럴 수 없습니다. 이것은 지금까지 필자의 스크립트입니다. if 문을 2 개 사용하면 되겠지만, Im을 반복문으로 만들려는 것처럼 말입니다. 임씨는 스크립팅에 매우 익숙하며 조언을 주시면 감사하겠습니다. 감사합니다루프를 만들려고 시도하고 있습니다.

#!/bin/bash 
#source "/node/procTestData/test_directory" 
session1="/node/procTestData/test_directory/path_to.proc"  
session2="/node/procTestData/test_directory/path_to.proc2" 

file1="/node/procTestData/test_directory/000scratch/path_to.log" 
file2="/node/procTestData/test_directory/path_to.log" 


dir=$PWD 
echo "this is $dir" 

rundir1="/node/procTestData/test_directory/000scratch/single.app/work*" 
rundir2="/node/procTestData/test_directory/000scratch/Test.app/work*" 

/d/sw/dugproc/20130927/_appCmdLine "$session1" 
wait 
/d/sw/dugproc/20130927/_appCmdLine "$session2" 

wait 

echo "session is" 
echo $session1 
echo $session2 

wait 

echo "rundir is" 
echo $rundir1 
cd $rundir1 
./run_harness.sh 

wait 

echo "rundir is" 
echo $rundir1 
cd $rundir1 
./run_harness.sh 

wait 

echo $rundir2 
cd $rundir2 
./run_harness.sh 

wait 

echo "this is $dir" 
cd $dir 
echo "this is file1" 
echo $file1 
echo $file2 

wait 
#  for par in $file1; do 
#  if [ -e $par ]; then 
#  echo "this is par" 
#  echo "$par" 
#  fi 
#  for par2 in $file2; do 
#  if [ -e $par2 ]; then 
#  echo "this is par2" 
#  echo "$par2" 
#  fi 
#  done 

    for $par in ($file1 , $file2); do 
    if [ -e $par ]; then 
    echo "this is par" 
    echo "$par" 
    elif [ -e $par ] 
    echo "this is par2" 
    echo "$par" 
    fi 
#  done 
exitmessage=$(grep "volume created successfully" $par $par2) 
error1=$(grep "error" $par $par2) 
error2=$(grep "ERROR" $par $par2) 
error3=$(grep "SEVERE" $par $par2) 
error4=$(grep "severe" $par $par2) 
error5=$(grep "Error" $par $par2) 
error6=$(grep "Severe" $par $par2) 
error7=$(grep "WARNING" $par $par2) 
error8=$(grep "Warning" $par $par2) 
error9=$(grep "warning" $par $par2) 

echo $error1 
echo $error2 
echo $error3 
echo $error4 
echo $error5 
echo $error6 
echo $error7 
echo $error8 
echo $error9 
echo $exitmessage 
echo "finished" 
done 
2>&1 > darraghLogFile.log || exit 100 
+0

? 이 스크립트를 루프에서 계속 실행 하시겠습니까 ?? – Ashish

+1

'wait'는 스크립트가 어떤 명령도 비동기 적으로 실행하지 않기 때문에 아무런 도움이되지 않습니다. –

답변

0

그것의 정말 전혀 분명 당신이하려고하지만, 아마도 당신은 같은 것을 찾고있는 것을 : 당신이 원하는 정확히

#!/bin/bash 
source=/node/procTestData/test_directory 
session1=$source/path_to.proc 
session2=$source/path_to.proc2 
rundir1=$source/000scratch/single.app/ 
rundir2=$source/000scratch/Test.app/ 

while read session rundir; do 
    /d/sw/dugproc/20130927/_appCmdLine "$session"  
    cd $rundir 
    ./run_harness.sh 
done << EOF 
$session1 $rundir1 
$session2 $rundir2 
EOF 
관련 문제