Jimson James
Jimson James

Reputation: 3327

How to printf in bash with multiple arguments?

How do I print a formatted system date + hostname using printf in bash.

Something like printf "%s:%s\n" date hostname?

Upvotes: 23

Views: 38207

Answers (1)

jim mcnamara
jim mcnamara

Reputation: 16389

printf "%s:%s\n" "$(date)" "$(hostname)"

Upvotes: 42

Related Questions