目前我正在學習zsh的,現在我想用strftime
,但我得到:的zsh:strftime的命令沒有找到
zsh: command not found: strftime
我覺得我上來的一些錯誤,因爲我發現人們始終在他們的點文件中使用該功能。
目前我正在學習zsh的,現在我想用strftime
,但我得到:的zsh:strftime的命令沒有找到
zsh: command not found: strftime
我覺得我上來的一些錯誤,因爲我發現人們始終在他們的點文件中使用該功能。
strftime
在名爲datetime
的zsh
模塊中定義。 zmodload
命令從$module_path
中以冒號分隔的目錄列表加載模塊。
在我的系統:
% echo $module_path
/usr/lib/zsh/4.3.10
% ls -l $module_path
drwxr-xr-x 3 root root 4096 2009-11-05 01:03 zsh
% ls -l $module_path/zsh/datetime*
-rw-r--r-- 1 root root 9828 2009-09-10 02:45 /usr/lib/zsh/4.3.10/zsh/datetime.so
% type -a strftime
strftime not found
% zmodload zsh/datetime
% strftime %Y-%m-%d 1271603087
2010-04-18
% type -a strftime
strftime is a shell builtin
% /bin/date -d @1271603087 +%Y-%m-%d
2010-04-18
strftime
是一個C函數,我相信date
在命令行上具有所有相同的功能。
查看man date
瞭解更多。
一個使用--date=STRING
選項來指定格式化日期而不是獲取當前時間。