Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

redis-cli strips newline while loading script #674

Closed
kaandok opened this Issue · 2 comments

2 participants

@kaandok

Discussion: https://groups.google.com/d/topic/redis-db/pXPQ2Dk0WFc/discussion

Summary:

redis-cli strips the newline at the end of a script while loading scripts as follows:
$ redis-cli script load "$(cat /path/to/script.lua)"

This makes the SHA1 digest obtained from redis and by the commandline utility sha1sum differ.

It would be nice if redis-cli didn't do this since it is convenient to generate digests from the commandline and distribute them to the users of the scripts without even loading them to redis. It would also make digests returned from redis compatible with the commandline utility sha1sum.

@pietern

Your shell removes the newline. Bash does this according to its internal IFS variable, that determines how data is split.

You can make redis-cli read the last argument from STDIN to bypass this. For example:

$ cat /path/to/scriptfile.lua | redis-cli -x script load
@pietern pietern closed this
@kaandok

thanks for the explanation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.