problem with unix date util running in emacs shell
here's a oddity.
on Cygwin bash 开发者_StackOverflow中文版on Windows Vista, i can get date like this:
$ date
2010-11-30 4:40:48 AM PST
xah@xah-PC ~
$ date +%s
1291120855
but in emacs “shell”, running the same date command, i get this:
c:\Users\xah\web\xahlee_org\comp>which date
which date
/usr/bin/date
c:\Users\xah\web\xahlee_org\comp>date
date
The current date is: 2010-11-30
Enter the new date: (yy-mm-dd)
c:\Users\xah\web\xahlee_org\comp>date +%s
date +%s
The system cannot accept the date entered.
Enter the new date: (yy-mm-dd)
any idea what's going on?
This is because your emacs shell is actually a Windows Command Prompt shell and the date command gets sent to it and fails.
Take a look at this question to find out how you can configure emacs to use Cygwin's bash shell instead:
How can I run Cygwin Bash Shell from within Emacs?
You're hitting cmd.exe's date builtin, which is in no way like POSIX date(1). You could work around this by typing in the full path to the date command that you want.
精彩评论