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 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
add comment

2 Answers

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
add comment

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
add comment

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.