]> git.donarmstrong.com Git - zsh.git/commitdiff
url encoding with zsh
authormartin f. krafft <madduck@madduck.net>
Mon, 5 May 2008 13:46:51 +0000 (14:46 +0100)
committermartin f. krafft <madduck@madduck.net>
Mon, 5 May 2008 13:46:51 +0000 (14:46 +0100)
.zsh/func/urlencode [new file with mode: 0644]

diff --git a/.zsh/func/urlencode b/.zsh/func/urlencode
new file mode 100644 (file)
index 0000000..21e8ab7
--- /dev/null
@@ -0,0 +1,4 @@
+# http://www.michael-prokop.at/computer/config/.zshrc
+setopt localoptions extendedglob
+input=( ${(s::)1} )
+print ${(j::)input/(#b)([^A-Za-z0-9_.!~*\'\(\)-])/%$(([##16]#match))}