从字符串或文件(.piped)中管道输入数据
bin_directory/command1
#!/bin/bash
read X
echo hello $X > output
from commandlib import CommandPath
command_path = CommandPath("./bin_directory")
来自字符串
with open("person", "r") as handle:
command_path.command1().piped.from_string("harry").run()
文件“output”将包含
hello harry
来自文件句柄
with open("person", "r") as handle:
command_path.command1().piped.from_handle(handle).run()
文件“output”将包含
hello harry
来自文件名
command_path.command1().piped.from_filename("person").run()
文件“output”将包含
hello harry