Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I currently have a workflow which relies on several bash commands sequentially in the OSX terminal. It is basically a process which starts with a file x.csv, it does an operation on it and generates another file y.dat. Then uses y.dat as input for another command line app and produces the output z.png.

I want to write a script to automate the procedure with a script that takes in x and produces z directly. I don't know how to do it, or if to use AppleScript or bash and how.

Thanks

share|improve this question

In bash you can use a pipe i.e. | to pass the output of one command as the input of the next.

http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-4.html

share|improve this answer

I used the tutorial in http://floppix.ccai.com/scripts1.html to get started. That is all I needed. I execute a command and use a variable to store the filename of the output. I then execute the next command passing the filename of the previous stage as a parameter.

share|improve this answer
    
Please expand your answer and explain what exactly you did. Having a link is nice but it doesn't really tell us how you solved your problem. – slhck Dec 18 '12 at 14:26
    
You are just linking to a short cookbook for a simple script (which does not contain any hint about how to pipe data from one process to the other) – Matteo Dec 18 '12 at 14:30
    
I added some more detail. Basically I'm just using intermediate files instead of passing the output directly onto the next command. – Stewie Dec 18 '12 at 14:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .