I have created below function, when I am executing this function with shell script it completed fine but not going to next steps
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))
}
In my shell script I have placed below lines:
time_check /u01/scripts/copy.sh ${1} | tee ${copylog}
echo "Starting Next Steps now:" >>> Issue here , not coming to this phase.
I am getting some output like this:
This step completed in : 0d:0h:12m:9s ( which is output of time_check /u01/scripts/copy.sh )