diff options
author | root <root@jones.dk> | 2009-10-24 16:38:24 +0200 |
---|---|---|
committer | root <root@jones.dk> | 2009-10-24 16:38:24 +0200 |
commit | 2dac6c15d822f51b96c7d2ca4b74cabf11d4079e (patch) | |
tree | 72ba811317dbeb26a49a0d17c66308d0cb83da38 /localsmsapps | |
parent | 75bf87a29e5695515854703fce86eafea325b45e (diff) |
Generalize uriunescape function, and cleanup a bit.
Diffstat (limited to 'localsmsapps')
-rwxr-xr-x | localsmsapps | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/localsmsapps b/localsmsapps index 0938820..54379a6 100755 --- a/localsmsapps +++ b/localsmsapps @@ -6,13 +6,16 @@ simpleword() { echo "$1" | tr '[A-Z]' '[a-z]' | egrep '^[a-z][a-z0-9-]+$' || exit 1 } +uriunescape() { + echo "$1" | perl -e 'use URI::Escape; print lc(uri_unescape(<STDIN>));' +} + urlencode() { -# echo "$1" | perl -e 'use Encode; use URI::Escape; use URI::URL; print URI::URL->new(Encode::decode("utf8", uri_unescape(<STDIN>)))."\n";' echo "$1" | perl -e 'use URI::URL; print URI::URL->new(<STDIN>)."\n";' } -phone="$1"; shift -set -- `echo "$@" | perl -e 'use URI::Escape; print lc(uri_unescape(<STDIN>));' | sed -e 's/\+/ /g'` +phone=`uriunescape "$1" | sed -e 's/\+/ /g'`; shift +set -- `uriunescape "$@" | sed -e 's/\+/ /g'` app=`simpleword "$1"`; shift case "$app" in |