Search code examples
bashshellgnu-parallel

GNU parallel escaped character that is not intend to escape


parallel --dry-run wget {1} :::: <(echo "http:://a&b")

produces

wget http:://a\&b  

How do I prevent the \ before &? I've tried the option -q, but the output is the same.


Solution

  • You use eval:

    parallel --dry-run eval wget {1} :::: <(echo "http:://a&b")
    

    In URLs you typically want the escaping, though, because otherwise you are starting wget in the background and running the command b.

    Here is a (contrived) example where it does make sense:

    parallel eval echo {} :::: <(echo "this & echo that")
    

    A less contrived example is in the man page: https://www.gnu.org/software/parallel/man.html#EXAMPLE:-Aggregating-content-of-files