From 35c000054dc381e39cd82d8ba7dc5111f13366a1 Mon Sep 17 00:00:00 2001
From: Carmelo Pellegrino <carmelo.pellegrino@gmail.com>
Date: Wed, 11 Nov 2015 01:50:23 +0100
Subject: [PATCH] correcting the array handling

---
 patch-control.sh | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/patch-control.sh b/patch-control.sh
index ac303c2..de337dd 100755
--- a/patch-control.sh
+++ b/patch-control.sh
@@ -210,9 +210,11 @@ ssh ${DAQ_USER}@${DAQ_SERVER} "[ -e ${ROOT_FILE} ]" && {
 
 let "run_duration_seconds = ${run_duration} * 60"
 
+declare -a PROCS
+
 daq_log_file=~/.km3_private/daq_`printf "%08d" ${run_number}`.log
 JGetMessage -H ${DAQ_SERVER} -T MSG -d 3 >${daq_log_file} &
-PROCS=(${PROCS[*]} $!)
+PROCS+=($!)
 
 # Copy selected run setup file, changing the run number
 cat ${rs_file} | sed -e "s/RUNNUMBER/${run_number}/" >${DM_DATA_DIR}/dm.detectorfile
@@ -230,22 +232,22 @@ log "Launching the DAQ with the following command line: daq.sh ${run_number} ${r
 daq_driver_log_file=~/.km3_private/daq_driver_`printf "%08d" ${run_number}`.log
 daq.sh ${run_number} ${run_start_time} ${run_duration_seconds} ${DAQ_SERVER} ${DAQ_USER} ${duty_cycle} >${daq_driver_log_file} &
 DAQ_PROC_ID=$!
-PROCS=(${PROCS[*]} ${DAQ_PROC_ID})
+PROCS+=(${DAQ_PROC_ID})
 
 # Launch the DM
 dm_driver ${run_duration_seconds} | mono ${DM_EXE_DIR}/DetectorControl.exe --control --reset --jollytoken jollyroger &
-PROCS=(${PROCS[*]} $!)
+PROCS+=($!)
 
 # Put notification mark in the system tray
 zenity --notification --text="Run ${run_number} is on going." &
-PROCS=(${PROCS[*]} $!)
+PROCS+=($!)
 
 # Point the browser to the correct address, if required
 zenity --question \
        --text="Would you like to open the DetectorManager GUI?" \
        --title="Question (at $(date))" \
        --cancel-label="No, thanks" && firefox http://localhost:8102/gui/main.htm &
-PROCS=(${PROCS[*]} $!)
+PROCS+=($!)
 
 # Wait the end of the run
 end_run_time=`nowUTC`
-- 
GitLab