stringhelper.sh 192 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 function truncate() { [[ $# -lt 2 ]] && return 1 local STRING=$1 [[ ${#STRING} -gt ${2} ]] && STRING="${STRING:0:$(($2-3))}..." echo -n ${STRING} } # vim: set et ts=4 sw=4: