python – 有没有办法捕获结构输出的shell命令集合?

我收集了一些fab文件,用于管理服务器,为客户端安装应用程序等.当我将安装文档作为fabfile和自述文件提供时,其中一些人并不高兴.通常有经验丰富的系统管理员,而不是python程序员.如果我可以给他们一个bash脚本,这是一个记录各种fabfiles做了什么,那将是伟大的.有谁知道最好的方法吗?

我不需要帮助手动将fab命令转换为bash.我正在寻找一种程序化的方法来捕获命令流,无论是来自paramiko还是Fabric还是远程主机本身.

解决方法:

你写了:

If I Could give them a bash script that is a record of what the varIoUs fabfiles did then that would be great.

然后

I don’t need help to manually translate fab commands into bash. I’m looking for a programatic way to capture the stream of commands, either from paramiko or fabric or on the remote host itself.

将您的问题消除歧义以包括示例fab文件和所需输出将非常有帮助.

那就是说,你在博士中看到了吗?如果COMMAND是占位符或文字,我找不到提到它的地方,它似乎是一个占位符. (我可能完全误解了选项的意图,fab文档,请更多示例!)

-d COMMAND, --display=COMMAND
Prints the entire docstring for the given task, if there is one. 
Does not currently print out the task’s function signature, 
so descriptive docstrings are a good idea. (They’re always a good idea,  
of course – just moreso here.)

但听起来你可以通过将完整的命令插入docstring来获得你想要的东西.

我希望这有帮助.

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...