lazy saunter

(personal learnings in computation)

Thursday, June 28, 2007

how to make a recipe book

lets say you have typed up a bunch of your favorite recipes (or essays on your favorite computer-related topics) and saved each one as a separate file. this seems logical since putting all the recipes in the same file might make it difficult later to rearrange the order of the recipes or to insert or delete recipes (ok- just some copying and pasting would do it but that is still too much work).

if you re using windows, i dont know what to do.

if you re using linux, you can write a very simple shell script that will create a "book" file and write all the contents of all your recipes to that file. in the following case, i put all my recipe files in a "recipes" directory. the working directory contains the script, the book file, and a file containing a line to separate files with like "****************".


#!/bin/bash
for X in recipes/*
do
cat $X >> recipe_book.txt
cat line.txt >> recipe_book.txt
done


the script can be executed with "./script_name.sh".

1 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home