• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Saving "traceroute" results into a variable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving "traceroute" results into a variable


  • Subject: Re: Saving "traceroute" results into a variable
  • From: Christopher Nebel <email@hidden>
  • Date: Thu, 25 Jul 2002 20:44:03 -0700

On Thursday, July 25, 2002, at 10:57 AM, email@hidden wrote:

Can anyone tell me how I might be able to write an AppleScript that would execute a "traceroute" command, and pipe the output of that into a variable? (It eventually needs to get written to a text file, so if it's easier to go direct, please let me know)

"do shell script" is your friend. It will execute an arbitrary sh command and return the resulting output as a string. Since you just want the output in a file, it's probably easier to do that as part of the shell command, so you'd have something like this:

do shell script "/usr/sbin/traceroute demand.stream.aol.com > ~/datadump"

You have to be explicit about the command path because "do shell script" uses a very restricted PATH to find commands. If you didn't put the shell redirect on the command, the output would appear as the result of the command, so you could stick it in a variable like this:

set x to do shell script "your_command_here"


--Chris Nebel
AppleScript Engineering
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Saving "traceroute" results into a variable (From: email@hidden)

  • Prev by Date: Re: osascript
  • Next by Date: Re: Sorting finder windows by name, date etc.
  • Previous by thread: Saving "traceroute" results into a variable
  • Next by thread: Selecting newest file in folder
  • Index(es):
    • Date
    • Thread