Answer the question
In order to leave comments, you need to log in
How and where does bash remove an array element?
I decided to make a script that will watch the output of the bot upon completion of it and look for "reboot" there in order to restart it and start all over again. I have not yet figured out how the script itself will be restarted from it, but not about that now (although if you suggest how to implement this, I will only be grateful). So far, I'm testing on this js script:
console.log("test");
console.log("test1");
read -p "Enter the programm's path with .js: " path
cd $path
echo "node $path/main.js"
nodeLogs="$(node $path/main.js)"
echo $nodeLogs
IFS="\n" read -a nodeLogsArr <<< "$nodeLogs"
echo "${nodeLogsArr[1]}"
for element in "${nodeLogsArr[@]}"; do
echo "$element"
done
for logs in ${nodeLogsArr[@]}; do
if (($logs="reboot")); then
echo "U couldn't see it!!!"
#git pull
else
echo "$logs"
fi
done
$ ./test
Enter the programm's path with .js: .
node ./main.js
test test1
test
test
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question