summaryrefslogtreecommitdiffstats
path: root/urldecode
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@server-speed.net>2011-05-15 14:02:38 +0200
committerFlorian Pritz <bluewind@server-speed.net>2011-05-15 14:02:38 +0200
commit2a85f5f9ca4fe5b758b489f02f9ec0d0aff55587 (patch)
tree34274a0e70db49a0a51cb37d08e19d969ee8831c /urldecode
parentfcb85132b3bb40f054cb775cbffe0e412f064ce6 (diff)
downloadbin-2a85f5f9ca4fe5b758b489f02f9ec0d0aff55587.tar.gz
bin-2a85f5f9ca4fe5b758b489f02f9ec0d0aff55587.tar.xz
add new scripts
Signed-off-by: Florian Pritz <bluewind@server-speed.net>
Diffstat (limited to 'urldecode')
-rwxr-xr-xurldecode16
1 files changed, 16 insertions, 0 deletions
diff --git a/urldecode b/urldecode
new file mode 100755
index 0000000..19df702
--- /dev/null
+++ b/urldecode
@@ -0,0 +1,16 @@
+#!/bin/bash
+arg="$1"
+i="0"
+while [ "$i" -lt ${#arg} ]; do
+ c0=${arg:$i:1}
+ if [ "x$c0" = "x%" ]; then
+ c1=${arg:$((i+1)):1}
+ c2=${arg:$((i+2)):1}
+ printf "\x$c1$c2"
+ i=$((i+3))
+ else
+ echo -n "$c0"
+ i=$((i+1))
+ fi
+done
+