Zshスクリプトが画面を見つけることができません

Zshスクリプトが画面を見つけることができません

私はzsh、高エネルギー物理学でいくつかのデータ分析を自動化するために、分離モードで特定の名前を持つ複数の画面を起動し、その中で特定のプロセスを実行するスクリプトを作成しました。ただし、時には次のエラーが発生します。

No screen session found.

表示する特定のパターンが認識されず、ランダムにerror発生しているようです。私の目標は、プログラムを異なる方法で複数回実行することです。command-line arguments時には、このエラーは2回目の実行で表示され、時には3回目のポップアップで表示されることがあります。分析を実行するには、ループ内で定義された画面に特定のコマンドを送信する必要がありますfor。コードは以下のように表示されます。

#! /bin/zsh
### Script for running everything in screens ###
### System argument screen name suffix ###
echo You have the following screens running:
screen -ls
#echo Press any key to proceed. NOTE THAT YOUR OTHER SCREENS WILL GET KILLED!
#read
#pkill -15 -U arisevon screen ## We make sure that no screens are running for now
bkgarr=(TopJets BosonJets DiBoson TTbar)
sigarr=(NM1 NM2 NM3 Scenario4 Scenario6)
puarr=(50PU 140PU)
lumarr=(30 300 3000)
echo Please type 1 for 50PU samples and 2 for 140PU samples
read PU
if [[ $PU -ne 1 && $PU -ne 2 ]] ; then
    echo You have to enter 1 or 2
    return 1
fi

echo Please type 1 for 300fb-1 and 2 for 3000fb-1
read lum

if [[ $lum -ne 1 && $lum -ne 2 ]] ; then
    echo You have to enter 1 or 2
    return 1
fi

if [ $PU = 1 ]; then
    let "lum = $lum + 1"
    #echo $lum
fi

ex NEWrunReader.py  <<EOEX
  :43s/Lumi.*/Lumi=$lumarr[lum]/
  :x
EOEX

echo Compiling the reader file!!!
root -l << EOF
.L readerSummerStd.C+
EOF

echo Press any key to proceed or Ctrl+C to abort!
read 

for index in $bkgarr
do
    screen -dmS "${index}_${lumarr[lum]}_${1}" 
    #screen -S $index -p 0 -X stuff "$(typeset -p bkgarr)"$'\r'
    screen -S "${index}_${lumarr[lum]}_${1}" -p 0 -X stuff "./NEWrunReader.py SummerStd $puarr[PU]_$index $1 >& "${index}_${lumarr[lum]}_${1}".txt &"$'\r'
done

for sigind in $sigarr
do
    screen -dmS "${sigind}_${lumarr[lum]}_${1}" 
    #screen -S $sigind -p 0 -X stuff "$(typeset -p bkgarr)"$'\r'
    screen -S "${sigind}_${lumarr[lum]}_${1}" -p 0 -X stuff "./NEWrunReader.py SummerStd $puarr[PU]_$sigind $1 >& "${sigind}_${lumarr[lum]}_${1}".txt &"$'\r'
done
return 0

ベストアンサー1

おすすめ記事