"allowed" operations in bash read while loop
I have a file text.txt
that contains two lines.
first line
second line
I am trying to loop through in bash using the following loop:
while read -r LINE || [[ -n "$LINE" ]]; do
# sed -i 'some command' somefile
echo "echo something"
echo "$LINE"
sh call_other_script.sh
if ! sh some_complex_script.sh ; then
echo "operation failed"
fi
done <file.txt
When called some_complex_script.sh
, only the first line is processed , but when commented out, all two lines are processed.
some_complex_script.sh
does all sorts of things like initial processes, sqlplus starting from WildFly, etc.
./bin/call_some_script.sh | tee $SOME_LOGFILE &
wait
...
sqlplus $ORACLE_USER/$ORACLE_PWD@$DB<<EOF
whenever sqlerror exit 1;
whenever oserror exit 2;
INSERT INTO TABLE ....
COMMIT;
quit;
EOF
...
nohup $SERVER_DIR/bin/standalone.sh -c $WILDFLY_PROFILE -u 230.0.0.4 >/dev/null 2>&1 &
My question is , if there are any operations that should not be called in some_complex_script.sh
, but in a loop (it can also take 10 minutes to complete, is it generally a good idea?) That could break this loop. The script is called using Jenkins and Publish over SSH plugin . When some_complex_script.sh
called by itself, no problem.
source to share