I'm trying to write a script that takes a timestamp (just hours, no minutes) written in a file and transforms it in seconds since Epoch, but it is failing and I don't understand why.
The script that I'm using:
#!/bin/bash
time=$(cat time.txt)
stime=$(date --date "$(echo '$time')" +%s)
echo "$stime"
Contents of time.txt
06
Output:
date: invalid date ‘$time’