redis-cli strips newline while loading script #674

kaandok opened this Issue Sep 14, 2012 · 2 comments


None yet

2 participants

kaandok commented Sep 14, 2012



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 commented Sep 15, 2012

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 Sep 15, 2012
kaandok commented Sep 18, 2012

thanks for the explanation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment