Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1046229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:06:48+00:00 2026-05-16T16:06:48+00:00

I’m pretty much a novice to shell scripting. I’m trying to send the output

  • 0

I’m pretty much a novice to shell scripting. I’m trying to send the output of some piped commands to an open command in bash in OSX.

My ultimate goal is to compile a Flex/Actionscript application from TextWrangler by calling a bash script with a little Applescript and have the result played directly in a Flash Player. The Applescript is pretty much doing it’s job. But the bash script doesn’t work as I expect. Same results when I ommit the Applescript and simply put it directly in terminal.

This is what the Applescript is sending to terminal:

mxmlc -warnings=false DocumentClass.as | tail -n 1 | sed 's/[[:space:]].*$//' | open -a 'Flash Player'

So basically, I read the last line of the output of mxmlc, which usually looks something like this:

/Users/fireeyedboy/Desktop/DocumentClass.swf (994 bytes)

and I strip everything after the first space it encounters. I know it’s hardly bulletproof yet, it’s still just a proof of concept. When I get this roughly working I’ll refine. It returns the desired result so far:

/Users/fireeyedboy/Desktop/DocumentClass.swf

But as you can see, I then try to pipe this sed result to the Flash Player and that’s where it fails. The Flash Player seems to open way too early. I would expect the Flash Player to open only after the script finished the sed command. But it opens way earlier.

So my question is twofold:

  1. Is it even possible to pipe an
    argument to the open command this
    way?
  2. Do I need to use some type
    of delay command to get this
    working, since the open command doesn’t seem to be waiting for the input?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T16:06:48+00:00Added an answer on May 16, 2026 at 4:06 pm

    You’re trying to give the name of the swf file as input to stdin of the open command, which it doesn’t support.

    It expects the file name as an argument (similar to -a).

    You can do something like this:

    FILENAME=`xmlc -warnings=false DocumentClass.as | tail -n 1 | sed 's/[[:space:]].*$//'`
    open -a 'Flash Player' $FILENAME
    

    or on a single line:

    open -a 'Flash Player' `xmlc -warnings=false DocumentClass.as | tail -n 1 | sed 's/[[:space:]].*$//'`
    

    If you’re using bash (or another modern POSIX shell), you can replace the pretty unreadable backtick character with $( and ):

    open -a 'Flash Player' $(xmlc -warnings=false DocumentClass.as | tail -n 1 | sed 's/[[:space:]].*$//')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.