Rahix/tbot

[Help] Run a pipe shell command

thanhtam92 opened this issue · 3 comments

Hi everyone,

Could you tell me the way to run a pipe shell command with tbot Linux Bash ? For example: dmesg | grep "ABC"

Thanks in advance !

I found a way:
lnx.exec0("dmesg", tbot.machine.linux.Pipe, "grep", "ABC")

I'm very welcome any way which is better.
Thanks !

Rahix commented

Hi,

what you show above is exactly right; linux.Pipe is the correct way to perform piping in the remote shell. Though I wouldn't write out the module path like you did, I usually import tbot.machine.linux like this:

from tbot.machine import linux

...
lnx.exec0("dmesg", linux.Pipe, "grep", "ABC")

Let me know if you need anything else!

Thank @Rahix for reply.
I will close this issue.