Converting VMAX NAA Values

Quick bash script I put together to convert VMAX NAAs into the values seen within PowerPath on Linux hosts. There's a PowerShell script floating around the internet to do the same thing but nothing in bash.

#!/bin/bash
# (C) 2014 Derek Morton
# Licensed under GPL 2.0

naa=$1
naalen=${#naa}

if [ $naalen == 32 ]; then
        device1=${naa:24:2}
        device2=${naa:26:2}
        device3=${naa:28:2}
        device4=${naa:30:2}
        echo "Frame/Symmetrix ID: ${naa:16:4}/${naa:8:12}"
        echo -e "Logical Device: \x$device1\x$device2\x$device3\x$device4"

elif [ $naalen == 36 ]; then
        device1=${naa:28:2}
        device2=${naa:30:2}
        device3=${naa:32:2}
        device4=${naa:34:2}
        echo "Frame/Symmetrix ID: ${naa:20:4}/${naa:12:12}"
        echo -e "Logical Device: \x$device1\x$device2\x$device3\x$device4"

else
        echo "NAA Value must be 32 or 36 characters"
        echo "ex: 6090a038f0cd4e5bdaa8248e6856d4fe"
        echo "or: naa.6090a038f0cd4e5bdaa8248e6856d4fe"
fi

Sample output:

$ ./naa_to_powerpath.sh 60000970000295700173533034373635
Frame/Symmetrix ID: 0173/000295700173
Logical Device: 4765

# powermt display dev=emcpowera
Pseudo name=emcpowera
Symmetrix ID=000295700173
Logical device ID=4765
state=alive; policy=SymmOpt; queued-IOs=0