I want to store date values into a variable for future use. Please correct the sample script:
#!/bin/bash
Now_hourly = $(date +%d-%b-%H_%M)
Now_daily = $(date +%d-%b-daily)
echo $(Now_hourly)
echo $(Now_daily)
The output should be :
12-Feb-17_50
and
12-Feb-daily
But When I run the script, I am getting below error :Now_hourly: command not found
Now_daily: command not found
you can change the script like:
#!/bin/bash
Now_hourly=$(date +%d-%b-%H_%M)
Now_daily=$(date +%d-%b-daily)
echo "$Now_hourly"
echo "$Now_daily"
I think the problem is spaces around =
output:
12-Feb-12_03
12-Feb-daily
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With