Add "Get the username of the current user" entry

This commit is contained in:
Crestwave
2019-01-19 15:34:11 +08:00
parent 27ed118a1a
commit cb7fedc419
4 changed files with 29 additions and 4 deletions

View File

@@ -82,8 +82,21 @@ $ printf '%s\n' "$date"
Fri 15 Jun - 10:00 AM
```
## Get the username of the current user
**CAVEAT:** Requires `bash` 4.4+
```shell
$ : \\u
# Expand the parameter as if it were a prompt string
$ printf '%s\n' "${_@P}"
black
```
## Generate a UUID V4
**CAVEAT**: The generated value is not cryptographically secure.
**Example Function:**
```sh