我在
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 toCOMMAND
.