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×ó±ßÄǸö¼ü.