Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help] Run a pipe shell command #61

Closed
thanhtam92 opened this issue Oct 11, 2021 · 3 comments
Closed

[Help] Run a pipe shell command #61

thanhtam92 opened this issue Oct 11, 2021 · 3 comments
Labels
question A question

Comments

@thanhtam92
Copy link

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 !

@thanhtam92
Copy link
Author

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

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

@Rahix
Copy link
Owner

Rahix commented Oct 11, 2021

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!

@Rahix Rahix added the question A question label Oct 11, 2021
@thanhtam92
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question A question
Projects
None yet
Development

No branches or pull requests

2 participants