about summary refs log tree commit diff stats
path: root/fold.sh
diff options
context:
space:
mode:
authorCase Duckworth2020-05-30 13:41:12 -0500
committerCase Duckworth2020-05-30 13:41:12 -0500
commit7dcbff5d337dc1666372c7b0b3c24832ec5dc00d (patch)
tree9c14ea6ea81666e49587fbdc74a382b33f459ee4 /fold.sh
parentBring URL transforming up to spec (diff)
downloadbollux-7dcbff5d337dc1666372c7b0b3c24832ec5dc00d.tar.gz
bollux-7dcbff5d337dc1666372c7b0b3c24832ec5dc00d.zip
Remove unneeded files
Diffstat (limited to 'fold.sh')
-rw-r--r--fold.sh26
1 files changed, 0 insertions, 26 deletions
diff --git a/fold.sh b/fold.sh deleted file mode 100644 index ee88c6e..0000000 --- a/fold.sh +++ /dev/null
@@ -1,26 +0,0 @@
1#!/usr/bin/env bash
2
3fold() {
4 shopt -s checkwinsize
5 (
6 :
7 :
8 )
9 width="${1:-$COLUMNS}"
10 while read -r line; do
11 : "${line// / }"
12 IFS=$'\n' read -d "" -ra words <<<"${line// /$'\n'}"
13 ll=0
14 for word in "${words[@]}"; do
15 wl="${#word}"
16 if ((ll + wl > width)); then
17 printf '\n'
18 else
19 ((ll += wl))
20 printf '%s ' "$word"
21 fi
22 done
23 done
24}
25
26fold "$@"