Here's a bash script that loops through 4-digit codes and prints the Unicode character associated with the code. Make sure your terminal supports Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export BASHOPTS=xpg_echo | |
from=0000 to=ffff | |
from=$(printf '%d' "0x$from") to=$(printf '%d' "0x$to") | |
while test "$from" -le "$to"; do | |
num=$(printf '%04x' "$from") | |
bash -c "echo -n \"\u$num\"" | |
from=$((from+1)) | |
done |
References
https://unix.stackexchange.com/questions/65803/why-is-printf-better-than-echo
https://stackoverflow.com/questions/5517500/generating-hex-numbers-of-a-certain-range
No comments:
Post a Comment