Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to take an IP address from my Terminal, right click, select Services > Whois and get the results back somehow.

This doesn't exist so I'm wanting to create a simple Automator script to do that. But, I'm running into a few problems.

This is what I've done - Automator Actions:

Get Specified Text

xxx.xxx.xxx.xxx

Run Shell Script

for x in "$@";
do whois $x; 
done

View Results

But all I get in View Results is this:

(
  ""
)

Any suggestions?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Make sure to pass the input to the shell script as arguments and not to STDIN:

For showing the results, you could drag Run AppleScript to the bottom of the pane and use the following commands:

on run {input, parameters}
    set msg to ""
    repeat with itm in input
        set msg to msg & "
" & itm
    end repeat
    tell application "Finder"
        display alert "Whois" message msg
    end tell
end run
share|improve this answer
    
Awesome answer. Works fine in Automator but I get an error when I run it through the right click menu: 'The action "Run AppleScript" encountered an error.' –  Snow Crash Sep 21 '12 at 17:27
    
@SnowCrash Updated the script. –  Daniel Beck Sep 21 '12 at 18:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.