diff options
author | typebrook <typebrook@gmail.com> | 2020-05-19 21:45:42 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2020-05-19 21:45:42 +0800 |
commit | 22d08b5e59821ba0dd474fdca3da501ac665ce3b (patch) | |
tree | 299c241eab94a29a4f467104d04a4c830c6c6623 | |
parent | 1b00a9cacf289a94f1fc9e5a1035c74c242dd23d (diff) |
Use variable to get terminal width
-rwxr-xr-x | gist | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -324,7 +324,7 @@ _print_records() { | |||
324 | raw_output="$(_color_pattern "$pattern" <<<"$raw_output")" | 324 | raw_output="$(_color_pattern "$pattern" <<<"$raw_output")" |
325 | fi | 325 | fi |
326 | decorator=$(( $(grep -o '\\e\[0m' <<<"$raw_output" | wc -l) *9 )) | 326 | decorator=$(( $(grep -o '\\e\[0m' <<<"$raw_output" | wc -l) *9 )) |
327 | echo -e "$raw_output" | cut -c -$(( $(tput cols) +decorator )) | 327 | echo -e "$raw_output" | cut -c -$(( $COLUMNS +decorator )) |
328 | done | 328 | done |
329 | 329 | ||
330 | [[ -z $INPUT ]] && _show_hint || true | 330 | [[ -z $INPUT ]] && _show_hint || true |