Skip to content

redis-cli: force repl after reading standard input #2194

Closed

Description

@filippog

hi,
it would be nice to be able to force the redis REPL after evaluating the commands from stdin with -x. This could allow for example to have interactive sessions without displaying the password anywhere (by reading it from a file and passing it on stdin before the repl). Another example would be to provide pre-setup redis instances and have the REPL to play with the data, what do you think?

thanks,
filippo

Activity

  1. antirez commented on Dec 19, 2014

    @antirez
    Contributor

    I understand the need but it's a strange behavior, what about source instead?

    > ping
    PONG
    > source "/tmp/a_few_commands.txt"
    ... output here ...
    > echo more-interactive-stuff
    more-interactive-stuff
    
  2. filippog commented on Dec 19, 2014

    @filippog
    Author

    to clarify, this would be an additional command line switch (e.g. -X) and would not change the default behaviour.

    source would work for the hidden password use case, however what I had in mind is also being able to provide a ready-to-use wrapper around redis-cli. e.g. on a machine running multiple redis instances for multiple services you could type service1-redis-cli and have a REPL for redis-cli running for service1 without having to know port/password/etc, the wrapper could look like this for example

    #!/bin/sh
    pass=$(cat <some_file_with_password>)
    echo "auth $pass" | redis-cli -X "$@"
    

    HTH,
    filippo

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions