Two shortcuts for displaying system_profiler data types
man system_profiler function sptypes() { /usr/sbin/system_profiler -listDataTypes | /usr/bin/sed '1d' | /usr/bin/sort | /usr/bin/nl return 0 } unset -f sptype function sptype() { declare -i num declare sptypename num=$1 #sptypename="$(/usr/sbin/system_profiler -listDataTypes | /usr/bin/sed '1d' | /usr/bin/sort | /usr/bin/nl | /usr/bin/egrep "^[[:space:]]+${num}[[:space:]]" | /usr/bin/awk '{print $NF}')" sptypename="$(/usr/sbin/system_profiler -listDataTypes | /usr/bin/sed '1d' | /usr/bin/sort | /usr/bin/nl | /usr/bin/grep -w "${num}" | /usr/bin/awk '{print $NF}')" printf "\n\e[1m%s\e[m\n\n" "${sptypename}:" system_profiler "${sptypename}" return 0 } sptypes sptype 5 sptypes | grep -i pref sptype 26 | less -R #------------------------------------------ # interactive version unset -f sptype function sptype() { declare -a array declare -i num array=($(/usr/sbin/system_profiler -listDataTypes | /usr/bin/sed '1d' | /usr/bin/tr '\n' ' ')) echo printf "%s\n" "${array[@]}" | /usr/bin/nl echo printf "\n\e[1m%s\e[m" "Please select a number: " read num num=$num-1 echo printf "\n\e[1m%s\e[m\n\n" "${array[${num}]}: " system_profiler $(echo "${array[${num}]}") #system_profiler $(echo "${array[${num}]}") | less -R return 0 } sptype