循环中的Perl脚本在一次运行后结束

前端之家收集整理的这篇文章主要介绍了循环中的Perl脚本在一次运行后结束前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在 shell脚本的循环中运行Perl脚本:

while [ $currentDate -le $toDate ]; do
    // code here...
    exec /users/my_user/script_name $currentDate
    // code here...
  done

我已经确认了while循环循环.但是,在运行一次Perl脚本之后,while循环结束.

有人可以对此有所了解吗?

解决方法

你正在使用exec. exec用新程序替换shell进程.您可能只想删除exec关键字.

exec [-cl] [-a name] [command [arguments ...]] [redirection ...]

Replace the shell with the given command.

Execute COMMAND,replacing this shell with the specified program.
ARGUMENTS become the arguments to COMMAND.

猜你在找的Perl相关文章