|
From: | Clyde Jones |
Subject: | Re: Execute subshells after parallel is called |
Date: | Fri, 15 Feb 2019 17:59:40 -0800 |
Try this:
seq 10 | parallel "echo \$(openssl rand -hex 6)-\$(openssl rand -hex 6) {}"
or
seq 10 | parallel 'echo `openssl rand -hex 6`-`openssl rand -hex 6` {}'
Your shell is expanding the initial call to openssl when made within
double quotes.
--
Joe
On Fri, Feb 15, 2019 at 4:23 PM Clyde Jones <slash5toaster@gmail.com> wrote:
>
> Hi
> I am not sure how to do this properly - when I pipe a command to parallel, execution of any subshells parallel's execution string happen before parallel operates on each item.
>
> How do I have parallel execute after each is called?
>
> e.g.
>
> seq 10 | parallel "echo `openssl rand -hex 6`-`openssl rand -hex 6` {}"
> 25fbef1c2172-e9c650de7711 1
> 25fbef1c2172-e9c650de7711 2
> 25fbef1c2172-e9c650de7711 3
> 25fbef1c2172-e9c650de7711 4
> 25fbef1c2172-e9c650de7711 5
> 25fbef1c2172-e9c650de7711 6
> 25fbef1c2172-e9c650de7711 7
> 25fbef1c2172-e9c650de7711 8
> 25fbef1c2172-e9c650de7711 9
> 25fbef1c2172-e9c650de7711 10
>
> Where I'd expect to see something like this:
>
> for q in $(seq 10) ; do echo `openssl rand -hex 6`-`openssl rand -hex 6`; done
> 13908cd3134d-180c0ad781f7
> 0112797cea95-06a3a67a255a
> 8d2ea26121ed-0a0bcbd334b5
> 07b12553c20e-3b384c7392ef
> 103a7644a6fe-1064a67d6a15
> a9a9fba6b810-907f705f80ed
> 6e61ad4ff6c3-ae6e319bfdf5
> 72ad1bc7fcf5-c4162d625028
> 06a73f7d3316-8913a20f949d
> cd55f779504a-1ec0bfe3db42
>
>
> If I run the command directly, I get the expected behaviour, but I want to be able to build up strings.
>
>
> Thanks
>
>
> --
> Clyde Jones
> 650-720-5774
>
> Don't you know there ain't no devil, it's just god when he's drunk.
> - Tom Waits
> ... .-.. .- ... .... ..... - --- .- ... - . .-. .--.-. --. -- .- .. .-.. .-.-.- -.-. --- --
[Prev in Thread] | Current Thread | [Next in Thread] |