Reputation: 9627
I have added alias in my .gitconfig
rnd = !sh -c \"git commit -m '$(curl -s http://whatthecommit.com/index.txt)'\"
And now when I type
git add . && git commit rnd
I get an error sh: 1: Syntax error: Unterminated quoted string
Upvotes: 0
Views: 3952
Reputation: 56518
You have your quoting backward a bit... you want to single-quote the command to run, pass that to sh, and use the backslash-quoted double quotes around your string expansion...
rnd = !sh -c 'git commit -m \"$(curl -s http://whatthecommit.com/index.txt)\"'
And also, just a note, in your question you call git commit rnd
, but in reality, you would call this as git rnd
.
Upvotes: 1