我有一个文件,其中每一行包含两个字符串,这是从shell启动命令的两个参数。我将使用GNU并行为每一行启动我的命令。现在,如果我手动启动,我会写:
./phantomjs rasterize.js http://www.google.it/ google.png一切都正常。但如果我尝试并行,就会出问题:
parallel --verbose -a myfile --no-run-if-empty ./phantomjs rasterize.js这是输出
./phantomjs rasterize.js http://www.google.it/\ google.png
./phantomjs rasterize.js http://www.anothersite.it/\ pic.png
Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat] [zoom]
paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"
Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat] [zoom]
paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"我不明白为什么它不能工作,为什么在链接后的详细模式(前两行)中有\字符。
cat -vet输出:
http://www.google.it/ google.png$
http://www.anothersite.it/ pic.png$
$
$发布于 2014-07-13 14:42:45
您非常接近why in verbose mode (first two row) after link there's "\" character?的答案
GNU并行将每一行视为一个参数,并将引用任何特殊字符(如空格)。这就是你所看到的。这是一个特性-不是一个bug。这意味着,无论您在单行上放置了什么,它都将被正确引用,以便在shell中使用。
但您不希望出现默认行为。您希望GNU并行将行拆分为2个参数。列分隔符是空格:
parallel --verbose -a myfile --colsep ' ' --no-run-if-empty ./phantomjs rasterize.jshttps://stackoverflow.com/questions/24721116
复制相似问题