+
+ #Use the current slot if it's empty and we don't know which slot is loaded'
+ if [ $loadedslot -eq -2 ]; then
+ set x `sed -n '
+{
+ /^.*Storage Element '$currentslot':Empty/ {
+ s/.*Storage Element \([0-9][0-9]*\):Empty/\1/p
+ q
+ }
+ /^.*Storage Element '$currentslot':Full/ {
+ s/.*Storage Element \([0-9][0-9]*\):Full/-2/p
+ q
+ }
+}
+' < $mtx_status 2>& 1`
+ shift # get rid of the "x"
+ loadedslotx=$1
+ if [ ! -z $loadedslotx ]; then
+ loadedslot=$loadedslotx
+ fi
+ fi
+
+ #Use the first empty slot if we don't know which slot is loaded'
+ if [ $loadedslot -eq -2 ]; then
+ set x `sed -n '
+{
+ /^.*Storage Element \([0-9][0-9]*\):Empty/ {
+ s/.*Storage Element \([0-9][0-9]*\):Empty/\1/p
+ q
+ }
+}
+' < $mtx_status 2>& 1`
+ shift # get rid of the "x"
+ loadedslot=$1
+ fi
+