[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Difference between single and double quotes for parallel?
From: |
Ole Tange |
Subject: |
Re: Difference between single and double quotes for parallel? |
Date: |
Thu, 16 Dec 2010 11:32:58 +0100 |
On Thu, Dec 16, 2010 at 7:42 AM, Maciej Pilichowski
<pilichowski.maciej@gmail.com> wrote:
> On 12/16/2010 12:26 AM, Ole Tange wrote:
>>
>> Start by reading the man page on QUOTING.
>
> There is a slight problem, because I read the EXAMPLES section too, and one
> section says one thing, and the second another.
>
> EXAMPLES:
> Another solution is to quote the whole command:
> parallel "zcat {} >{.}" ::: *.gz
>
> QUOTING:
> For example this will not work:
> ls *.gz | parallel -q "zcat {} >{.}"
>
> You repeated the quoting statement here, so I guess the latter is true.
The difference is -q.
>> Please provide a full example and explanation of what it does and what
>> you expected it to do. It is unclear what you mean by the above. This
>> works as expected:
>>
>> $ FN=a
>> $ echo 1 | parallel echo $FN
>> # prints a 1
>
> I would like to call composed command. So something like this
>
> FN=something with space
> cat my_file | parallel script1 "{}" "$FN" \; script2 "{}" "$FN"
This example is better, but please provide a full example that can be
run directly. Like these:
FN="two spaces"
echo 1 | parallel -q echo {} "$FN"
# Prints 2 spaces between 'two' and 'spaces'
-q will not work with composed commands as it will quote the ; as
well. So composed commands have to be quoted by hand:
# Using export:
FN2="two spaces"
export FN2
echo 1 | parallel echo {} \"\$FN2\" \; echo \"\$FN2\" {}
# Prints 2 spaces between 'two' and 'spaces'
# Without export:
FN3="two spaces"
echo 1 | parallel echo {} \""$FN3"\" \; echo \'"$FN3"\' {}
# By quoting the space in the variable
FN4='two\ \ spaces'
echo 1 | parallel echo {} $FN4 \; echo $FN4 {}
/Ole