[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: |
Mon, 20 Dec 2010 10:45:59 +0100 |
On Mon, Dec 20, 2010 at 8:39 AM, Maciej Pilichowski
<pilichowski.maciej@gmail.com> wrote:
>> # Without export:
>> FN3="two spaces"
>> echo 1 | parallel echo {} \""$FN3"\" \; echo \'"$FN3"\' {}
>
> This one suits me best but if I am not wrong, this could be written without
> double quoting:
>
> echo 1 | parallel echo {} \"$FN3\" \; echo \"$FN3\" {}
That will not preserve two spaces in a row. You will get one space
instead of two (which may be good enough in your case).
Neither will work on any input. They fail if the variable contains two
spaces in a row, ' and " like this:
FN3="two spaces'\""
For that you probably need to quote the variable content before using
it. I do not know if there is an easy BASH way to do that. Maybe
someone else knows?
/Ole