简体   繁体   English

使用Automator的Whois终端脚本

[英]Whois Terminal script with Automator

I'd like to take an IP address from my Terminal, right click, select Services > Whois and get the results back somehow. 我想从终端获取IP地址,右键单击,选择“服务”>“ Whois”,然后以某种方式获取结果。

This doesn't exist so I'm wanting to create a simple Automator script to do that. 这不存在,所以我想创建一个简单的Automator脚本来执行此操作。 But, I'm running into a few problems. 但是,我遇到了一些问题。

This is what I've done - Automator Actions: 这就是我所做的-自动操作:

  1. Get Specified Text (this will be the IP address) 获取指定的文本(这将是IP地址)

  2. Run Shell Script for x in "$@" ; 在“ $ @”中为x运行Shell脚本; do whois $x; 做whois $ x; done 完成

  3. View Results 查看结果

But all I get in View Results is this: 但是,我在查看结果中得到的全部是:

(
  ""
)

Any suggestions? 有什么建议么?

You must print the result, use echo . 您必须打印结果,使用echo

For a single IP address, use " $@ " instead of using a loop. 对于单个IP地址,请使用“ $ @ ”,而不要使用循环。

echo $(whois "$@")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM