Today I wrote my first (trivial, but "real") bash script... 10 years after studying linux scripting in university: https://gist.github.com/3714934<p>Do you remember what was the first problem you scripted your way out of or how long after you learnt your first scripting language?
I don't remember my first script. Though I do remember the most value I've ever gotten out of a script.
To set the scene, I had a high school science class, and in it you were supposed to do journal entries. (Read: Notes.) You kept track of all your notes and put them in a table of contents. The instructor kept all the notes on his website. It was the night before the last day of school. Or the night before that. I hadn't turned in my organized notes, and thus had a C in the class. I needed them turned in yesterday.
So what I did was:
1. Download the powerpoint of all the notes.
2. Use libreoffice to convert it to pdf.
3. Used less to read the data from the pdf into text.
4. Used sed to remove the garbage characters from the text.
5. The file had uniform formatting, so I went over it with sed again to turn it into an HTML file.
6. Went over the HTML file by hand to correct anomalies and fill in answers to questions. (This was the 'real' assignment, fill in various questions throughout the notes.)
7. Wrote out an table of contents. (Which in retrospect could have been done with a sed script.)
8. Turned the whole thing in.
He never actually read it (As it was quite apparent from a glance that I had done it.), but I got an A in the class; and a night of no sleep.
It was a script for invoking a C program stored in all of the machines forming a cluster of 16: the whole point of the thing was to generate traffic between the PCs in a structured fashion, measuring the bandwidth and latency results.
To set the scene, I had a high school science class, and in it you were supposed to do journal entries. (Read: Notes.) You kept track of all your notes and put them in a table of contents. The instructor kept all the notes on his website. It was the night before the last day of school. Or the night before that. I hadn't turned in my organized notes, and thus had a C in the class. I needed them turned in yesterday.
So what I did was:
1. Download the powerpoint of all the notes.
2. Use libreoffice to convert it to pdf.
3. Used less to read the data from the pdf into text.
4. Used sed to remove the garbage characters from the text.
5. The file had uniform formatting, so I went over it with sed again to turn it into an HTML file.
6. Went over the HTML file by hand to correct anomalies and fill in answers to questions. (This was the 'real' assignment, fill in various questions throughout the notes.)
7. Wrote out an table of contents. (Which in retrospect could have been done with a sed script.)
8. Turned the whole thing in.
He never actually read it (As it was quite apparent from a glance that I had done it.), but I got an A in the class; and a night of no sleep.