Wanted to send a set of commands to redis from the command line and the following techniques work.
Working on the slot 1 database of redis here as specified by the
-n 1 parameter. With sample commands to flush the cache and then exit. You can chain the commands to the complexity level you like or write a script against a redis SDK with pipelined commands.
Bash command to run splitting the commands with
echo -e "flushall async\nexit\n" | redis-cli -n 1
My preferred method of directly sending the commands using bash
redis-cli -n 1 <<<$'flushall async\nexit'