首页 > 解决方案 > 功能不进入下一步

问题描述

我已经创建了下面的函数,当我使用 shell 脚本执行这个函数时,它完成得很好,但不会进入下一步

 time_check()    
{     
. /u01/scripts/${1}.env     
export create_env_log=${logs}/create_env_log_${dts}.log     
echo 'STime:' date +%s > ${create_env_log}    
  "$@"    
echo 'ETime:' date +%s >> ${create_env_log}    

export st_time= grep -i STime ${create_env_log} |cut -d':' -f2       
export en_time= grep -i ETime ${create_env_log} |cut -d':' -f2      
export exectime=$((en_time-st_time))      
echo 'Completed in ' printf '%dd:%dh:%dm:%ds\n' $(($exectime/86400)) $(($exectime%86400/3600)) $(($exectime%3600/60)) $(($exectime%60))  >>  ${create_env_log}
Totexectime=$((Totexectime+exectime))      
echo 'This step completed in : 'printf '%dd:%dh:%dm:%ds\n' $(($exectime/86400)) $(($exectime%86400/3600)) $(($exectime%3600/60)) $(($exectime%60))      
}

在我的 shell 脚本中,我放置了以下几行:

time_check /u01/scripts/copy.sh ${1} | tee ${copylog}

echo "Starting Next Steps now:" >>> Issue here , not coming to this phase.

我得到一些这样的输出:

此步骤在 0d:0h:12m:9s 完成(这是 time_check /u01/scripts/copy.sh 的输出)

标签: linuxshellunixscriptingcommand

解决方案


推荐阅读