2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-15 06:12:59 +00:00
cheat.sheets/sheets/printf

13 lines
580 B
Plaintext
Raw Normal View History

# Assign the current date (timestamp style) as a shell variable, using the Bash
# builtin, and make it a suitable filename for a Gzip-compressed Tar archive.
2020-02-17 01:55:05 +00:00
printf -v FileName 'Backup_%(%F_%X)T.tgz' -1
# Simple, feature-full, and portable way by which to echo(1) output to STDOUT.
# Here, the current user's username is displayed, followed by a new line.
printf '%s\n' "$USER"
# Using the Bash builtin, this will output one integer per line, from one to
# one million, in a human-readable kind of way, by appropriately
# comma-separating the units.
2020-02-17 01:55:05 +00:00
printf "%'d\n" {1..1000000}