1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
#!/bin/sh testArray=(A,B,C,D,E) currentValue='' tempValue=x for i in "${testArray[@]}" do currentValue=$i echo "Processing " ${currentValue} if [ ${currentValue}==A ] then tempValue="$i 123" else tempValue=$i fi echo "Current loop " ${tempValue} echo `date` done |