ex51.sh
来自「Shall高级编程」· Shell 代码 · 共 22 行
SH
22 行
#!/bin/bash# Exercising the 'date' commandecho "The number of days since the year's beginning is `date +%j`."# Needs a leading '+' to invoke formatting.# %j gives day of year.echo "The number of seconds elapsed since 01/01/1970 is `date +%s`."# %s yields number of seconds since "UNIX epoch" began,#+ but how is this useful?prefix=tempsuffix=$(date +%s) # The "+%s" option to 'date' is GNU-specific.filename=$prefix.$suffixecho $filename# It's great for creating "unique" temp filenames,#+ even better than using $$.# Read the 'date' man page for more formatting options.exit 0
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?