parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing multiple flags in a single {} replacement


From: Ole Tange
Subject: Re: Passing multiple flags in a single {} replacement
Date: Mon, 14 May 2012 13:49:16 +0200

On Sun, May 13, 2012 at 5:48 PM, Alastair Andrew <a.andrew@strath.ac.uk> wrote:

> If you call it with the -d flag it'll run parallel in --dry-run mode echo-ing 
> its proposed runs allowing you to see the addition backslashes in the 
> generated arguments. Using --nice inflates the number backslashes too.

The problem you are experiencing can be summed up as:

  parallel -v ls ::: "-l -a"

Your problem is that you want the arguments to be parsed by the shell
and not escaped. That is in contrast to this situation:

  parallel -v ls ::: "my file"

where you do _not_ want the argument to be parsed by the shell, but
want it escaped so it is interpreted as a single argument.

What you are hitting is therefore a design decision which makes sense
most of the time, but not all the time.

So what to do? One solution is to give the command line to 'bash -c':

  parallel -v bash -c ls ::: "-l -a"

by doing so you can have your cake and eat it, too, so commands like
this will be possible:

  parallel -v touch {1}\; bash -c ls {2} ::: "my file" ::: "-l -a"

Here the first part is quoted and the second part unquoted (by bash
-c). It also does the right thing with --nice.


/Ole



reply via email to

[Prev in Thread] Current Thread [Next in Thread]