Bash Add Border
add_border() {
local -n _pic="$1"
local -n _outPic="$2"
local _width=${#_pic[0]}
local _border
_border=$(printf '%*s' "$_width" '' | tr ' ' '*')
_outPic=("$_border")
local _line
for _line in "${_pic[@]}"; do
_outPic+=("*${_line}*")
done
_outPic+=("$_border")
}
This builds a new grid with a * border around every side. It adds a full top and bottom row, then wraps each existing row from left and right.