在shell脚本中指定从文件读取的日期值并更新文件

在shell脚本中指定从文件读取的日期值并更新文件,shell,date,variables,Shell,Date,Variables,我必须通过从文件中读取并减去15分钟,然后用当前日期再次更新文件,从而将日期值分配给变量。由于某些原因,我的shell无法工作,每次我的开始日期都是现在的15分钟,而不是文件中的时间15分钟 start = `cat test.txt` Date_Start=`date -u --date="$start - 15 minutes" +"%Y-%m-%d %H:%M"` Date_End=`date -u +"%Y-%m-%d %H:%M"` destdir=/c/t

我必须通过从文件中读取并减去15分钟,然后用当前日期再次更新文件,从而将日期值分配给变量。由于某些原因,我的shell无法工作,每次我的开始日期都是现在的15分钟,而不是文件中的时间15分钟

start = `cat test.txt`

    Date_Start=`date -u --date="$start - 15 minutes" +"%Y-%m-%d %H:%M"`
    Date_End=`date -u +"%Y-%m-%d %H:%M"`

    destdir=/c/test.txt

    if [ -f "$destdir" ]
    then
        echo "$Date_End" > "$destdir"

    fi

test.txt
中有什么?在分配开始时,=符号中也应该没有间隙