I am trying to set a variable with the current date but having a tab between the date and the time. On the current variable I want also the time to be 1 hour back.
This works fine:
#date -d '1 hour ago' "+%Y-%m-%d"$'\t'"%H:"
2019-07-17 08:
But when I'm trying to set it to a variable the tab is replaced by space:
#var1=$(date -d '1 hour ago' "+%Y-%m-%d"$'\t'"%H:")
#echo $var1
2019-07-17 08:
#var1=`date -d '1 hour ago' "+%Y-%m-%d"$'\t'"%H:"`
#echo $var1
2019-07-17 08:
Any idea why this is happening and how i can include the tab in the variable?