翻译此shell命令:
$> sh -c 'if [ 1 -eq 1 ]; then echo TRUE; else echo FALSE; fi'
TRUE
到这个git别名~/.gitconfig
:
[alias]
test = !sh -c 'if [ 1 -eq 1 ]; then echo TRUE; else echo FALSE; fi'
结果是:
$> git test
<output-omitted> Syntax error: Unterminated quoted string
PS:不想将shell脚本映射到git别名。
PS2:正如@Cyrus和@CodeWizard所提到的,还需要使用一对引号来保护别名定义免受多个扩展级别的影响。避免@choroba提供的分号的好技巧。谢谢大家。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句