Closed bsysop closed 4 years ago
It's weird and I don't have a clue, but you can use alternate if then fi
solution with 3 more words now.
@bburgin may know, Brian contributes lots of features of rush.
If you need something i do, please tell me.
On Windows, I was able to get this to work: bash.exe -c 'echo -n "test1 test2" | rush -D " " bash.exe test.sh {}'
where test.sh contains: [[ ! -d ./$1 ]] && echo $1
Got it, you means to write a script to run inside, understand
Some other tools have the next syntax:
TOOL_CMD -- sh -c 'something_to_exec {}'
Then you choose "SH" to interpret your command inside, then you can do any bash script syntax there.
Gnu/parallel does it simply, you dont need call sh or bash to execute bash script functions inside.
rush inside calls 'sh -c "xxxxx" ', script is not necessary, if else
works , but &&
([[ ! -d ./{} ]] && echo {}
) failed, weird.
Oh guys, i think i got what happens here, first at all i made a mistake in my first post in that issue, you can see in for command
and in gnu/parallel
i used [[ -d {} ]]
, and in rush i used [[ ! -d {} ]]
, the negative data...
But anyways you will understand what make me think have something wrong:
In gnu-parallel/for loop/others
when i run
[[ ! -d ./{} ]] && echo {}
If dont exist the folder, that just be ignored, but in rush he gives a error.
rush --jobs 1 '[[ -d ./{} ]] && echo {}'
works perfect
but false conditional fails
rush --jobs 1 '[[ ! -d ./{} ]] && echo {}'
give error in stderr if folder dont exists.
Would be more proper to just ignore in case folder dont exist?
What about: if [ ! -d ./{} ]; then echo {}; else echo 0; fi
Hi @bburgin that works! Just not so useful as
[[ something ]] && command
I think we can close this issue, looks more a rush "how to" than an error!
Thank you very much for your time.
Hi Shen, first at all, thank you very much for rush, im a gnu/parallel heavy user, and now im migrating to rush, running away form perl =]
I normally execute something like this
or
but in rush i go the next.
with command
Do you mind what could happens here?
Thank you very much!.