实例代码 while read line ; do ssh -p20002 $line -o StrictHostKeyChecking=no xxxxxxxxx done < ip.txt while 只循环一次原因: while 读取文本的第一行,然后执行循环,执行到ssh这部时,因为ssh会读取标准输入(stdin),把所有文本都读取了,因此while没有数据,便跳出循环. 解决方法: 在ssh中使用 -n 参数: -n Redirects stdin from /dev/null (ac…
背景 使用spark执行mapPartitionsWithIndex((index,iterator)=>{....}),在执行体中将iterator进行一次迭代后,再次根据iterator执行迭代,iterator迭代体未执行. 猜想及验证过程 猜测iterator只能执行一次迭代. 测试例子如下: val rdd1 = sc.makeRDD(1 to 10,2) val rdd2 = rdd1.mapPartitionsWithIndex{(index,iterator)=>{ var r…
var name = "The window"; var object = { name: "My Object", getName: function(){ console.log(this.name); } } object.getName(); // My Object (object.getName)(); // My Object (object.getName = object.getName)(); // The window 来分析下调用的结果: 第…