08-11-2016, 11:09 AM
Een externe contributie:
PHP Code:
#!/bin/bash
declare -a myArray
for i in `seq 0 9`; do myArray[$i]=$(($(random -er 100;echo $?)+1)); done
for index in "${!myArray[@]}"; do newArray[$index]=${myArray[$index]}; done
myArray[$index]=-7;
B=$index;
A=0;echo -n "1st Array:[";for index in "${!myArray[@]}"; do echo -n ${myArray[$index]}; if [ $A -lt $B ]; then echo -n ","; fi;A=$(($A+1)); done; echo \];
A=0;echo -n "2nd Array:[";for index in "${!newArray[@]}"; do echo -n ${newArray[$index]}; if [ $A -lt $B ]; then echo -n ","; fi;A=$(($A+1)); done; echo \];