bash shell脚本之获取时间日期
2015-01-22 15:15 雪夜&流星 阅读(1503) 评论(0) 收藏 举报shell中的时间日期获取
cat test5:
#!/bin/bash # using the backtick character testing=`date` echo "The date and time are:" $testing date=`date +%Y-%m-%d_%H-%M-%S` echo "The date are:" $date
添加可执行权限:chmod u+x test5
运行:./test5 结果如下:
The date and time are: Thu Jan 22 15:13:33 CST 2015 The date are: 2015-01-22_15-13-33
浙公网安备 33010602011771号