Wednesday 14 November 2012

How to iterate through an array in bash? one liner


$ export MYARRAY=("one" "two" "three" "four")
$ for i in ${MYARRAY[@]}; do echo $i;done
one
two
three
four

and to reverse the loop



$ for (( idx=${#MYARRAY[@]}-1 ; idx>=0 ; idx-- )) ; do    echo ${MYARRAY[idx]} ; done

How to scroll up using screen in linux

Crtl + a then press ESC to enter copy mode.

You use the mouse wheel to scroll up and down.