尝试使用单个 while 循环从用户收集变量并运行顺序“at”命令。单数 at 命令有效,尝试合并失败且没有错误。在这种特殊情况下,输出显示作业已创建,但第一个操作从未完成。
#!/bin/bash
PATH=$PATH:/usr/openv/netbackup/bin:/usr/openv/netbackup/bin/admincmd:/usr/openv/volmgr/bin
read -p "Enter the time and date to deactivate the policies (format - 24hr Month Date example 0400 May 09) : " offtime
read -p "Enter the time and date to reactivate the policies (format - 24hr Month Date example 0400 May 09) : " ontime
while read -r i;
do
bpplinfo $i -modify -inactive | at $offtime;
bpplinfo $i -modify -active | at $ontime
done < /tmp/policies.txt