存在一种在echo
?前面创建时间戳的更好方法。
目前,我这样做:
#!/bin/sh
if mount | grep -q /mnt/usb; then
echo `date +%R\ ` "usb device already mounted"
else
echo `date +%R\ ` "mounting usb device..."
mount -t msdosfs /dev/da0s1 /mnt/usb
if mount | grep -q /mnt/usb; then
echo `date +%R\ ` "usb device successfully mounted"
fi
fi
输出应如下所示:
10:36 usb device already mounted
echo_time
会按照您的期望进行操作,直到您的邮件中有%
签名。这不是一个非常可靠的解决方案。