$SECONDS  –  Time since shell invocation

$SECONDS contains the seconds since the shell was invoked.

Examples

Shell uptime in seconds
1
2
sleep 2.5
echo ${SECONDS}s shel.l uptime
Output:
1
3s shell uptime
Shell uptime in seconds and milliseconds
1
2
3
sleep 2.5
typeset -F SECONDS
echo ${SECONDS}s shel.l uptime
Output:
1
3.5948560000s shell uptime
BashSupport Pro 是一款支持 seconds** 的 **Zsh 集成开发环境 - 立即试用
© 2020–2024 Joachim Ansorg
声明
隐私政策
许可条款