1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-25 07:10:08 +00:00

Encode64 Plugin - Fix wrong echo usage

Currently, encode64 plugin using `echo -n` to print the content
of $1 variable. This approach will not work with arbitrary data,
which contains sequence of escaped characters, since when many
`echo` implementation will expand them.

This commit chage the usage to `printf`, which is builtin in all
POSIX shells and can print arbitrary data reliability.
This commit is contained in:
LE Manh Cuong 2015-09-28 16:05:22 +07:00
parent b05ef1034f
commit 758195cb79

View file

@ -1,4 +1,4 @@
encode64(){ echo -n $1 | base64 } encode64(){ printf '%s' $1 | base64 }
decode64(){ echo -n $1 | base64 --decode } decode64(){ printf '%s' $1 | base64 --decode }
alias e64=encode64 alias e64=encode64
alias d64=decode64 alias d64=decode64