fork download
  1. #!/bin/bash
  2. s="1 1 1 1 1 1 -1 -1 -1 -1 -1 10 10 10 10 10"
  3. awk '{a=0;for(i=1;i<=NF;i++) { if($i=="1") {a++} };print a}' <<< "$s"
Success #stdin #stdout 0s 4304KB
stdin
Standard input is empty
stdout
6