Skip to content

Commit

Permalink
0.20180108
Browse files Browse the repository at this point in the history
Current Locale
  • Loading branch information
zvezdochiot authored and mykaralw committed Jan 8, 2018
1 parent a82013b commit 301b738
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
Console CharMap
0.20180105
0.20180108

# Console CharMap

Bash script for view charmap in console.

Example:

```bash
$ bash charmap.sh 0040

UTF-8 Console CharMap 0.20180108

0040: @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~.
0080: ...
```

---
2018
zvezdochiot

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.20180105
0.20180108
36 changes: 26 additions & 10 deletions charmap.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
#!/bin/bash

printf "\n\t\tConsole CharMap\t\t0.20180105\n"
tlocale=$(echo "${LANG//*.}")

printf "\n$tlocale\t\tConsole CharMap\t\t0.20180108\n"

hb=$1
[[ -z $hb ]] && hb=0
printf -v xb "%d" "0x$hb"

for ii in {0..2047}
do
if [[ $ii -eq 0 || $(((ii+xb)%64)) -eq 0 ]]
then
printf "\n%04x: " $((ii+xb))
fi
printf -v hb "%x" $((ii+xb))
printf "\u$hb"
done

if [[ "$tlocale" = "UTF-8" ]]
then
for ii in {0..2047}
do
if [[ $ii -eq 0 || $(((ii+xb)%64)) -eq 0 ]]
then
printf "\n%04x: " $((ii+xb))
fi
printf -v hb "%x" $((ii+xb))
printf "\u$hb"
done
else
for ii in {0..255}
do
if [[ $ii -eq 0 || $(((ii)%64)) -eq 0 ]]
then
printf "\n%04x: " $((ii))
fi
printf -v hb "%x" $((ii))
printf "\u$hb"
done
fi
printf "\n"

0 comments on commit 301b738

Please sign in to comment.