Consider the script at the end of this email. It's effectively impossible to get EEEE FFFF or GGGG to accept the various values.
Either that or I am doing something incredibly stupid.
(It took me a while to factor this down and try virtually every 
workaround that would not involve writing external files.)

#!/bin/bash -f


# These three arrays never get values no matter what
typeset -A EEEE
typeset -A FFFF
typeset -A GGGG

typeset -A INLINE
typeset -A INFUNC

function testfunc() {
  eval INFUNC=( $( blkid /dev/${RECORD[3]} -o export | sed -e 's;\\ ;_;' -e 's;\(.*\)=;[\1]=;' ) )
  echo "Trying: FFFF+=( [${INFUNC[UUID]}]=boo )"
  eval FFFF+=( [${INFUNC[UUID]}]=boo )
}

tail --lines=+3 /proc/partitions | grep -v ram |
while read -a RECORD
do
  echo "Trying /dev/${RECORD[3]}"
  testfunc ${RECORD[3]}

  VV=$( blkid /dev/${RECORD[3]} -o export | sed -e 's;\\ ;_;' -e 's;\(.*\)=;[\1]=;' )
  eval INLINE=( ${VV} )
  if [ ${INLINE[UUID]} ]
  then
    echo "Trying: EEEE[${INLINE[UUID]}]=boo"
    eval EEEE[${INLINE[UUID]}]=boo
  fi
  echo "INLINE Keys: " "${!INLINE[@]}" = "${INLINE[@]}"
  echo "INFUNC Keys: " "${!INFUNC[@]}" = "${INFUNC[@]}"
  for AA
  in "${!INLINE[@]}"
  do
    if [ ${AA} == UUID ]
    then
      echo "Trying: GGGG[${INLINE[$AA]}]=${INLINE[DEVNAME]}"
      GGGG[${INLINE[$AA]}]=${INLINE[DEVNAME]}
    fi
  done
  echo
done

echo "EEEE Keys: " "${!EEEE[@]}" = "${EEEE[@]}"
echo "FFFF Keys: " "${!FFFF[@]}" = "${FFFF[@]}"
echo "GGGG Keys: " "${!GGGG[@]}" = "${GGGG[@]}"



Reply via email to