Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- fast_chr() {
- local __octal
- local __char
- printf -v __octal '%03o' $1
- printf -v __char \\$__octal
- REPLY=$__char
- }
- function unichr {
- local c=$1 # Ordinal of char
- local l=0 # Byte ctr
- local o=63 # Ceiling
- local p=128 # Accum. bits
- local s='' # Output string
- (( c < 0x80 )) && { fast_chr "$c"; echo -n "$REPLY"; return; }
- while (( c > o )); do
- fast_chr $(( t = 0x80 | c & 0x3f ))
- s="$REPLY$s"
- (( c >>= 6, l++, p += o+1, o>>=1 ))
- done
- fast_chr $(( t = p | c ))
- echo -n "$REPLY$s"
- }
- ## test harness
- for (( i=0x10000; i<0x10100; i++ )); do
- touch ${WORK_MOUNT_POINT}/$(unichr $i)
- done
- ######################################################################
- df -l --output=pcent | sed 's/%//g' | grep -Eo '[0-9]{1,3}'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement