如何编写此命令行?

发布于 2025-02-01 18:01:32 字数 538 浏览 3 评论 0原文

我正在使用oh-my-zsh。

我想制作ZSH命令mx google.com

并运行以下内容:

dig +short mx $1

然后,如果我

a p

在“ p”代表“以前”的地方运行(我在此处向其他更常见的约定开放)

我希望它运行(假设是否以前的行输出3 IP):

dig + short a ip1
dig + short a ip2
dig + short a ip3

对于每个结果,返回了上一个命令中。

我要支持上述约定的命令是atxtmxcname

这是当前全部我有:

alias a='f() { dig +short a $1 };f'

但是我不确定如何结合两者。

I'm using oh-my-zsh.

I want to make a zsh command mx google.com

And have it run the following:

dig +short mx $1

And then if I run

a p

where 'p' stands for "previous" (I'm open to other more common conventions here)

I want it to run (hypothetical if previous line outputs 3 IPs):

dig + short a ip1
dig + short a ip2
dig + short a ip3

for each result returned in the previous command.

The commands I want to support with the above convention are a, txt, mx, cname

This was currently all I had:

alias a='f() { dig +short a $1 };f'

but I am not sure how to combine the two.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文