标签:star shell 计算 val comm %s script second The
# if test $UID -ne 0 ; then
if [ $UID -ne 0 ];then
echo "Non root user.Please run as root."
else
echo "Root user"
fi
start=$(date +%s)
commands;
statements;
end=$(date +%s)
difference=$(( end - start ))
echo "Time taken to execute is $difference seconds."
eval $@
if [ $? -eq 0 ] ; then
echo "$CMD excuted successfully"
else
echo "$CMD excuted unsuccessfully"
fi
# [ $? -eq 0 ] && ...
标签:star shell 计算 val comm %s script second The
原文地址:https://www.cnblogs.com/kylingx/p/11643423.html