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

标签 perl shell

我在 shell 脚本中循环运行 Perl 脚本:

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

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

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

最佳答案

您正在使用 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 脚本在一次运行后结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17178181/

相关文章:

perl - 是否有复合哈希的 Hash::Util 替代方案?

linux - 在 KornShell 中检查大小大于零的多个文件

bash - 来源 : not found in shell script?

bash - 在容器内运行 shell 脚本

linux - 使用 ls 查找满足条件的列表文件

perl - 使用 OpenOffice::OODoc 传输表格样式

Perl:哈希引用访问键数组

perl - 卸载 cpan 安装的所有 perl 模块

mysql - Perl fetchrow_hashref 结果是不同的整数值与字符串值

linux - 如何在spark上执行shell脚本