2021-07-29 05:44:12 -07:00
|
|
|
#!/usr/bin/env sh
|
2021-07-29 00:37:35 -07:00
|
|
|
# YES_ZSH
|
2021-07-29 05:44:12 -07:00
|
|
|
# YES_BASH
|
|
|
|
# YES_DASH
|
2021-07-29 00:37:35 -07:00
|
|
|
|
2021-07-30 17:57:08 -07:00
|
|
|
scramble() { ### @-
|
|
|
|
### scrambles text in a predictable way using regex.
|
|
|
|
###
|
|
|
|
### sacbremls ttex in a pdrceailtbe way unsig reegx.
|
2021-08-02 06:06:13 -07:00
|
|
|
###
|
|
|
|
### **TODO:** consider renaming because scramble(1) already exists.
|
2021-07-29 05:44:12 -07:00
|
|
|
[ $# -eq 0 ] || { printf "%s\n" "$0: does not take arguments" >&2; return 1; }
|
2013-10-21 01:05:07 -07:00
|
|
|
local eggs='s/@\(\w\)\(\w\)\(\w\)/@\3\1@\2/g'
|
|
|
|
sed \
|
|
|
|
-e 's/\b\w/&@/g' \
|
|
|
|
-e "$eggs" -e "$eggs" -e "$eggs" -e "$eggs" \
|
2014-09-07 20:55:42 -07:00
|
|
|
-e "$eggs" -e "$eggs" -e "$eggs" -e "$eggs" \
|
2013-10-21 01:05:07 -07:00
|
|
|
-e 's/@//g'
|
|
|
|
}
|
2021-07-29 00:37:35 -07:00
|
|
|
|
2021-08-02 13:48:46 -07:00
|
|
|
[ -n "${preload+-}" ] || scramble "$@"
|