Fix awk bug on openwrt
This commit is contained in:
parent
e1e21c659c
commit
2dea28ea2a
1 changed files with 7 additions and 5 deletions
12
neofetch
12
neofetch
|
@ -1869,14 +1869,16 @@ getascii() {
|
||||||
ascii_strip="${ascii_strip//'\\'/ }"
|
ascii_strip="${ascii_strip//'\\'/ }"
|
||||||
ascii_strip="${ascii_strip//'\'}"
|
ascii_strip="${ascii_strip//'\'}"
|
||||||
|
|
||||||
# Get ascii file size in rows/cols
|
# Get lines/columns of the ascii file in pure bash.
|
||||||
ascii_size="$(awk 'END {printf NR " "}length>max{max=length}END{printf max}' <<< "$ascii_strip")"
|
ascii_length=0
|
||||||
lines="${ascii_size/ *}"
|
lines=1
|
||||||
ascii_length="${ascii_size/$lines}"
|
while IFS='\n' read -r line 2>/dev/null; do
|
||||||
|
[ ${#line} -gt "$ascii_length" ] && ascii_length=${#line}
|
||||||
|
lines=$((lines+=1))
|
||||||
|
done <<< "$ascii_strip"
|
||||||
|
|
||||||
padding="\033[$((ascii_length + gap))C"
|
padding="\033[$((ascii_length + gap))C"
|
||||||
printf "%b%s" "$print"
|
printf "%b%s" "$print"
|
||||||
|
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue