日期:2014-05-16  浏览次数:20576 次

date显示系统时间失败
以下是一段shell程序,用于显示当前系统时间,保存文件名为abc。
#!/bin/bash

#function time
Time()
{
TM='date +%R'
echo "The system time now is ${TM} "
}

echo "now is going to the function Time"

Time

echo "back from the function Time"

但是却不能得到想要的结果,显示结果为:
$ ./abc
now is going to the function Time
The system time now is date +%R 
back from the function Time

请问这是为什么呢?
谢谢!

------解决方案--------------------
貌似应该是这样的吧:

TM=`date +%R`

------解决方案--------------------
是键盘左上角1左边那个键.