• 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: Workflow to run shell script on contents of a Finder selection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Workflow to run shell script on contents of a Finder selection


  • Subject: Re: Workflow to run shell script on contents of a Finder selection
  • From: Steve Hayman <email@hidden>
  • Date: Thu, 13 Oct 2005 11:48:15 -0400

On 13-Oct-05, at 11:18 AM, peter boardman wrote:
I'm trying to write a workflow that runs shell scripts on the contents of a Finder-selected text file.

What's passed to the shell script action is the name of the file itself, not its contents. So if your shell script is simply "cat", with input from stdin, it will output just the name of the file because that's the data that is on stdin.


I would try something like this instead. Make your shell script action take input as arguments and then do

	cat "$1"

which will take the first argument - which is the name of the file, passed from the previous action - and cat its contents. Or you can get fancier - see below - and loop through the list of all items in case more than one are passed.

also I think you can safely skip that applescript action that converts the finder's selection to an alias. A workflow like this should work:

Get Selected Finder Items

Run Shell Script

	Shell: /bin/bash    Pass input: as arguments

	for f in "$@"
	do
		cat "$f"
	done


_______________________________________________ Do not post admin requests to the list. They will be ignored. Automator-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Workflow to run shell script on contents of a Finder selection
      • From: Christopher Nebel <email@hidden>
    • Re: Workflow to run shell script on contents of a Finder selection
      • From: pete boardman <email@hidden>
References: 
 >Workflow to run shell script on contents of a Finder selection (From: peter boardman <email@hidden>)

  • Prev by Date: Workflow to run shell script on contents of a Finder selection
  • Next by Date: Re: Workflow to run shell script on contents of a Finder selection
  • Previous by thread: Workflow to run shell script on contents of a Finder selection
  • Next by thread: Re: Workflow to run shell script on contents of a Finder selection
  • Index(es):
    • Date
    • Thread