我可以在PHP中执行此操作,但我尝试在BASH shell中工作.我需要一个数组,然后随机洗牌内容并将其转储到somefile.txt.
somefile.txt
因此给定数组Heresmyarray,a;b;c;d;e;f;它将产生一个输出文件,output.txt它将包含元素f;c;b;a;e;d;
a;b;c;d;e;f;
output.txt
f;c;b;a;e;d;
元素需要保留分号分隔符.我已经看过很多bash shell数组操作,但似乎没有什么比这个简单的概念更接近.感谢您的任何帮助或建议!
bash shell shuffle
bash ×1
shell ×1
shuffle ×1