0

I have the impression Im always typing again and again the same commands

ZRANGE mykey 0 100 WITHSCORES

and it is quite repetitive as I have to juggle between maps, sets, and sorted sets (and the client is not great, I can't use the same shortcuts that I use in my terminal to delete the previous/next word for instance)

Is there a way, like in bash, to write our own scripts to make our life easier ?

e.g

LISTALL mykey
baao
  • 71,625
  • 17
  • 143
  • 203
Thomas
  • 8,306
  • 8
  • 53
  • 92

1 Answers1

1

You can use Redis from bash with redis-cli if that is what you mean?

Then you can make bash aliases. So, in bash:

function LISTALL() { redis-cli "ZRANGE $1 0 100 WITHSCORES"; }

then you can do

LISTALL mykey

and use bash editing.

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • I meant inside the redis-cli (I have many redis instances I connect to). though your solution is a good idea – Thomas Sep 16 '16 at 15:05