#!/bin/bash # this is just a library # you will need to provide the following in the implementation: # 1. a bash associative array populated by the library's functions print_dashes(){ term_cols="$(tput cols)" for ((i = 0; i < "${term_cols}"; i++)); do printf -- "-" done } view_content(){ local -n _REF="${1}" print_dashes; printf "\n" for i in "${!_REF[@]}"; do [ "${i}" == "text" ] && { printf "[%s] \t=\t" "${i}" sed ':a;N;$!ba;s/\n/\\n/g' <<< "${_REF[${i}]}" continue } [ ! -z "${_REF[${i}]}" ] && printf "[%s] \t=\t%s\n" "${i}" "${_REF[${i}]}" done }