Translating this shell command:
$> sh -c 'if [ 1 -eq 1 ]; then echo TRUE; else echo FALSE; fi'
TRUE
To this git alias in ~/.gitconfig
:
[alias]
test = !sh -c 'if [ 1 -eq 1 ]; then echo TRUE; else echo FALSE; fi'
Results in:
$> git test
<output-omitted> Syntax error: Unterminated quoted string
PS: Don't want to map shell scripts to git aliases.
PS2: As @Cyrus and @CodeWizard have mentioned, one additional pair of quotes is needed to protect the alias definition against multiple levels of expansion. Nice trick to avoid semicolons provided by @choroba. Thanks everyone.
;
is a comment in.gitconfig
how you escape a comment IDK.