Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update date.md #107

Merged
merged 1 commit into from May 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions command/date.md
Expand Up @@ -152,5 +152,19 @@ difference=$(( end - start ))
echo $difference seconds.
```

当你考虑输出带有时间的字符串时,例如(Current time: 2019/05/19):

最常用的方法:

```shell
echo -e "Current time: $(date +"%Y%m%d")"
```

另一种方法:
```shell
suffix='Current time:'
#和echo的用法差不多,注意如果换成单引号就不能替换变量了。
date +"${suffix} %Y/%m/%d"
```

<!-- Linux命令行搜索引擎:https://jaywcjlove.github.io/linux-command/ -->