以下是我在 Mac OS X 上运行的 xargs 的一种设计用法:
$ head -c 128 /dev/urandom | openssl base64 -A | xargs -I {} echo {}
rPeQFDtZ+icGeminAWK70Qmo/AQO5ZiZsusZuP/hZeFP2lId5efwhpy/fdlaaARQy2CxJOl1LGliqKT/a0p8mD68ohs3DqhA288ZYwAZIgu1cZIgldcOPfiwX1/2EipHUYEhC30erGT5HyIKze5jEy2rS+8GbtW7m8ZAafAq4Eg=
然而,增加管道内容的长度似乎会破坏它:
$ head -c 512 /dev/urandom | openssl base64 -A | xargs -I {} echo {}
{}
有趣的是,如果你不使用-I
它,它也可以正常工作:
$ head -c 512 /dev/urandom | openssl base64 -A | xargs echo
iVgQHWnDYLfQnxodhTQro2mBxc8gE34TitIjl7ZUJZXw6votbKJKkumUeQ6nylIxY70eaLs70Uw2zqhIE81Nca4x4aiEa4pp9yjDrBIpRZjj9oRySeMXhmvFLtwhRR4AMgUQO/WI9OYvV6y+MOEu+fv3wHIi6Cb+drFgbZUoH1f87bUkBSj8JzdyEW0t2wUf9CqtZV/x1pRnzmDlP93gdSOkjqTnST+HL/thkCdgmdsNeA8bsZ5P6NzwTH4JD2bemdx7lzqHhlVxf/j+lD7uOJA/16clk32Cqxhmiz9x2ONPeadrn4S1KpgAYWjbgA/QwlUGXtyOeG6rZhvrRdv947EP49GAmbQhqVzW2Qf/RQeqnm2f3zzzbx1/wXGF97yy/2B6PjQ/4ylc44RYHqkfHhT15wrP4InZS5wrWvGSXqdGJihFjEauyNStEakllCbWdErwlooERM78A4volyy1MHta15/w80JEmSeXhHnpMaXDpW5TOyF4S2aJTGl7/58zdrIuHSnpIvYmJ+Je4jHlArV9oflvjjLcZ5DD4AWgyoEcaOXyTMgmk8Fuh73zUf+RmZNHPoo1yWJLal3+O1sb347lRIGGGiVEdiuH/jH4RFwklJ5an8YoyjjLd2v69oCbqD/tJ8rVmLvNlL5ARi6DJURkPoqLvZ4S2jfEaUDdKkM=
为什么不能-I
使用较长的字符串?我该如何让它工作?