Skip to content

Instantly share code, notes, and snippets.

@xianhuazhou
Created November 25, 2011 08:30
Show Gist options
  • Select an option

  • Save xianhuazhou/1393052 to your computer and use it in GitHub Desktop.

Select an option

Save xianhuazhou/1393052 to your computer and use it in GitHub Desktop.
shell script as redis client
#!/bin/bash
# add_item.sh
expect << EOF
spawn telnet localhost 6379
send "SELECT 10\n"
expect "OK"
send "SADD items \"${1}\"\n"
expect ".*"
send "quit\n"
exit
EOF
# usage
./add_item.sh "item here"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment