我有一个像这样的gitconfig:
[alias]
l = "!source ~/.githelpers && pretty_git_log"
Run Code Online (Sandbox Code Playgroud)
当我运行它时,我得到以下信息:
[desktop] git l
source ~/.githelpers && pretty_git_log: 1: source: not found
error: cannot run source ~/.githelpers && pretty_git_log: No such file or directory
fatal: While expanding alias 'l': 'source ~/.githelpers && pretty_git_log': No such file or directory
Run Code Online (Sandbox Code Playgroud)
当我添加任何其他shell内置程序进行测试时,它们运行良好:
[alias]
l = "!echo running from the builtin"
[desktop] git l
running from the builtin
Run Code Online (Sandbox Code Playgroud)
知道为什么无法从git中找到source命令吗?我正在运行zsh,但是更改为bash似乎没有什么不同:
[desktop] bash
[desktop] git l
source ~/.githelpers && pretty_git_log: 1: source: not found
error: cannot run source …Run Code Online (Sandbox Code Playgroud) 我有一个包含大量数据的文件,其中一个是 last-modified="1231231231"
其中 1231231231 是以毫秒为单位的纪元时间
<Translation
author_id="25"
id="02f18edd-ef7a-48e2-b614-b5888936017e"
language="de_DE"
last_modified="1325669156960"
phase="1"
target="[ phase="1" language="de_DE" ]"
translation_text="Funktionen"/>
Run Code Online (Sandbox Code Playgroud)
注意:last_modified="1325669156960"
我可以运行这个:
:%s/\([0-9]\{10\}\)\([0-9]\{3\}\)/\1/g
Run Code Online (Sandbox Code Playgroud)
找到所有这些事件并用“秒”字符串替换它们:
last_modified="1325669156"
然后我可以对这 10 个数字进行模式匹配,我想做的是将它们通过管道传输到 unix data -d 命令以返回格式化的数据戳:
:%s/[0-9]\{10\}/&/g
Run Code Online (Sandbox Code Playgroud)
在这个例子中,不是用我找到的相同的值(即&)替换,
我想以某种方式将该值传递给本质上:
date -d &
Run Code Online (Sandbox Code Playgroud)
并将其作为格式化的时间戳返回
last_modified="Wed Jan 4 07:13:32 MST 2012"
Run Code Online (Sandbox Code Playgroud)
关于如何做到这一点的任何想法?我必须每隔一周对各种文件执行此操作。