On Fri, Jan 07, 2011 at 18:54 +0800, Yue Wu wrote: > On Fri, Jan 07, 2011 at 06:32:44PM +0800, du yang wrote: > > > > Change '#!/bin/bash' to '#!/bin/sh' in the script header, then it may work. > > > > else please post the error details. > > > > I've tried it, but many messages like: > > usage: date [-jnu] [-d dst] [-r seconds] [-t west] > [-v[+|-]val[ymwdHMS]] ... > [-f fmt date | > [[[[[cc]yy]mm]dd]HH]MM[.ss]] > [+format] > > [:-gt: unexpected > operator > > mess up my mutt index screen at all. >
Oh it may be the symbol $() which caused the problem. It is ok on my machine just because /bin/sh is a soft link to bash. Here I post a new one. if it still doesn't work, you may have to post the date command help('date --help') to see if it is a problem of your 'date'. - du yang ============================== #!/bin/sh epoch="$1" _today="`date '+%Y-%m-%d'`" _yesterday=`date -d "$_today" "+%s"` if [ $_yesterday -gt $epoch ]; then echo "%4C %Z %[%d-%m-%y] %?M?%-11.11F [%2M]&%-16.16F? (%?c?%4c&%4l?) %?H?[%H]?%s%" else echo "%4C %Z %[ %H:%M] %?M?%-11.11F [%2M]&%-16.16F? (%?c?%4c&%4l?) %?H?[%H]?%s%" fi -- 临江仙·滚滚长江东逝水--杨慎 滚滚长江东逝水,浪花淘尽英雄。 是非成败转头空。青山依旧在,几度夕阳红。 白发渔樵江渚上,惯看秋月春风。 一壶浊酒喜相逢。古今多少事,都付笑谈中。