Send Multiple Commands to External Program
Since redis-cli
appears to read input from STDIN you could feed it an array with the command strings like this:
'MULTI', 'EXEC' | & redis-cli -h localhost -p 6379
Using echo
(alias for Write-Output
) is not required for feeding the array into the pipeline.
You could also store the command array in a variable first:
$cmds = 'MULTI', 'EXEC'$cmds | & redis-cli -h localhost -p 6379