-1

I'm trying to create a file using bash that has the current time as it's name. This is how I'm trying to do it:

echo 'hello' > date +"%T".txt

What am I missing?

ninesalt
  • 4,054
  • 5
  • 35
  • 75

1 Answers1

1

Use command substitution to capture date's output as a string.

echo 'hello' > "$(date +%T)".txt
John Kugelman
  • 349,597
  • 67
  • 533
  • 578