I am running a Perl script in a loop in a shell script:
while [ $currentDate -le $toDate ]; do
// code here...
exec /users/my_user/script_name $currentDate
// code here...
done
I have confirmed the while-loop loops. However, after one run of the Perl script, the while-loop ends.
Could someone please shed some light on this?
You're using exec. exec replaces the shell process with the new program. You probably want to just remove the exec keyword.
exec [-cl] [-a name] [command [arguments ...]] [redirection ...]Replace the shell with the given command.
Execute
COMMAND, replacing this shell with the specified program.ARGUMENTSbecome the arguments toCOMMAND.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With