linux shell-date样例

date.sh

#!/bin/bash

echo "The number of days since the year's beginning is $(date +%j)."

echo "The number of seconds elapsed since 01/01/1970 is $(date +%s)."

prefix=temp
suffix=$(date +%s)
filename=$prefix.$suffix
echo $filename

exit 0

验证

[root@kibana ~]# sh date.sh 
The number of days since the year's beginning is 288.
The number of seconds elapsed since 01/01/1970 is 1728889325.
temp.1728889325
[root@kibana ~]# 

猜你喜欢

转载自blog.csdn.net/z19861216/article/details/142918969