2
0

Make mpw_mkpw symlinkable.

This commit is contained in:
Maarten Billemont 2017-10-06 13:33:08 -04:00
parent 78c9618807
commit 81bd2e3065
2 changed files with 38 additions and 6 deletions

View File

@ -261,7 +261,10 @@ chr() {
# Outputs the decimal ASCII value of the given character.
#
ord() {
printf '%d' "'$1"
local str=$1 s
for (( s=0; s < ${#str}; ++s )); do
printf '%d' "'${str:s:1}"
done
} # _____________________________________________________________________
@ -274,7 +277,10 @@ ord() {
# Outputs the hexadecimal ASCII value of the given character.
#
hex() {
printf '%x' "'$1"
local str=$1 s
for (( s=0; s < ${#str}; ++s )); do
printf '%02X' "'${str:s:1}"
done
} # _____________________________________________________________________
@ -287,7 +293,10 @@ hex() {
# Outputs the character that has the given hexadecimal ASCII value.
#
unhex() {
printf "\\x$1"
local hex=$1 h
for (( h=0; h < ${#hex}; h+=2 )); do
printf "\\x${hex:h:2}"
done
} # _____________________________________________________________________
@ -1422,6 +1431,29 @@ shorten() {
# ______________________________________________________________________
# |__ CdSource ________________________________________________________________|
#
# cdsource [file]
#
# Change the current directory into the directory where the file is located, resolving symlinks.
#
cdsource() {
local source=${1:-${BASH_SOURCE[1]}}
while [[ $source ]]; do
[[ $source = */* ]] && cd "${source%/*}"
if [[ -L ${source##*/} ]]; then
source=$(readlink "${source##*/}")
else
source=
fi
done
} # _____________________________________________________________________
# ______________________________________________________________________
# |__ Up ________________________________________________________________|
#

View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
source bashlib
cdsource
getword() {
local cat=$1 pop_limit=$2 words=()
@ -19,9 +21,7 @@ declare -A categoryByCharacter=(
['v']=verb
)
templates=(
nvan
anvr
anavan
ran # ~32.0 bit
)
permutations=1