-1
NOW=$(date +%Y_%m_%d.%H:%M:%S)
echo "NOW: $NOW"

The goal is to replace the . between the d and % character with a space. How is this performed? Replacing the . with the space character produces and error.

gatorback
  • 1,384
  • 23
  • 48

1 Answers1

3

By using any of the standard quoting mechanisms:

NOW=$(date "+%Y_%m_%d %H:%M:%S")

or

NOW=$(date '+%Y_%m_%d %H:%M:%S')

or

NOW=$(date +%Y_%m_%d\ %H:%M:%S)
steeldriver
  • 81,074