0

How to write command result into empty variable?

#!/bin/bash
today=''
$today = $(date)
echo $today
0stone0
  • 34,288
  • 4
  • 39
  • 64
sdvjke
  • 55
  • 6

1 Answers1

2
  1. There shouldn't be a space around the =
  2. On variable assignment, no need for the $
#!/bin/bash
today=''
today="$(date)"
echo "${today}"
0stone0
  • 34,288
  • 4
  • 39
  • 64