1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-11-14 14:09:03 -08:00
rc/sh/trunc

3 lines
131 B
Bash
Executable file

#!/usr/bin/env bash
COLUMNS=${COLUMNS:-$(tput cols)}
awk -vL=${1:-$COLUMNS} '{e=length>L?"…":"";print substr($0,0,L-(e?1:0)) e}'