shenwei356 / rush

A cross-platform command-line tool for executing jobs in parallel
https://github.com/shenwei356/rush
MIT License
846 stars 63 forks source link

variables will not interpolated #25

Closed jkroepke closed 5 years ago

jkroepke commented 5 years ago

Prerequisites

Describe your issue

I need this because: https://stackoverflow.com/questions/24597818/exit-with-error-message-in-bash-oneline

Expected result:

seq 1 3 | rush -k '{ echo "{} {A}" && echo "{} {A}"; }' -v A=4
1 4
1 4
2 4
2 4
3 4
3 4

Actual result:

seq 1 3 | rush -k '{ echo "{} {A}" && echo "{} {A}"; }' -v A=4
{} 4
1 4
{} 4
2 4
{} 4
3 4

Workaround (use a sub shell):

seq 1 3 | rush -k '( echo "{} {A}" && echo "{} {A}"; )' -v A=4
1 4
1 4
2 4
2 4
3 4
3 4
shenwei356 commented 5 years ago

Hi, I think it's a design flaw of place holder. For rush -k '{ echo "{} {A}" && echo "{} {A}"; }', rush think { echo "{} is a place holder.

We may use new format {{}}, {{var}} to avoid this bug.

shenwei356 commented 5 years ago

Well, I fixed this, please help test it: https://github.com/shenwei356/rush/releases/tag/v0.4.1