diff options
author | LE Manh Cuong <manhcuongle@hotmail.com> | 2015-09-28 16:05:22 +0700 |
---|---|---|
committer | LE Manh Cuong <manhcuongle@hotmail.com> | 2015-09-28 16:05:22 +0700 |
commit | 758195cb791556c3f5268e7e075f3ab55bcd5e90 (patch) | |
tree | 4481d6ad4f6f862a5ab19875fa0bda49695fdf85 /plugins/encode64/encode64.plugin.zsh | |
parent | b05ef1034fffd7b0c29f1558a8a357ccce7ae74b (diff) | |
download | zsh-758195cb791556c3f5268e7e075f3ab55bcd5e90.tar.gz zsh-758195cb791556c3f5268e7e075f3ab55bcd5e90.tar.bz2 zsh-758195cb791556c3f5268e7e075f3ab55bcd5e90.zip |
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.
Diffstat (limited to 'plugins/encode64/encode64.plugin.zsh')
-rw-r--r-- | plugins/encode64/encode64.plugin.zsh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/encode64/encode64.plugin.zsh b/plugins/encode64/encode64.plugin.zsh index 4dbd1b453..53de6478a 100644 --- a/plugins/encode64/encode64.plugin.zsh +++ b/plugins/encode64/encode64.plugin.zsh @@ -1,4 +1,4 @@ -encode64(){ echo -n $1 | base64 } -decode64(){ echo -n $1 | base64 --decode } +encode64(){ printf '%s' $1 | base64 } +decode64(){ printf '%s' $1 | base64 --decode } alias e64=encode64 alias d64=decode64 |