On Tue, 07 Apr 2009 14:11:44 -0400, Walter Bright
<[email protected]> wrote:
Andrei Alexandrescu wrote:
It took me a couple of minutes to write under her eyes a script that
downloaded HTML, scraped the code for links, followed those of
interest, and output a concatenation of all pages she was interested
in, with details highlighted, that was loadable back in the browser.
I'd show her one iteration, get feedback, and get the next iteration
within seconds. All without "coding" in any sense as regularly
understood by Windows programmers.
I have no idea how to do that under unix. I obviously have not learned
anywhere near enough about it.
Probably start with wget, but I wouldn't know even close to enough about
information in that HTML to be able to do something like this :)
But shell scripting in itself is so powerful for this kind of stuff. I've
written lots of little scripts to do fantastic things that on Windows
would be so painful (without cygwin of course). Like renaming all files
of a certain type to something else, or copying select files to another
directory.
For example, here's a script I wrote to change which D compiler I want to
use:
#!/bin/bash
dir=$1
if [ "$2" = "" ]
then
mode=dmd
else
mode=$2
fi
if [ "$dir" = "" ]
then
echo please provide dmd directory argument
fi
if [ ! -f $dir/$mode.conf ]
then
echo invalid mode specified -- $mode
fi
rm -f ~/bin/dmd/*
ln -s $dir/dmd ~/bin/dmd/dmd
ln -s $dir/$mode.conf ~/bin/dmd/dmd.conf
hash -d dmd 2>/dev/null
just run it like:
. setupd ~/dmd2.021/dmd/bin
And now from now on, running dmd runs the right dmd with the right config
file (which is optionally specified).
Stuff like that is so painfully difficult on Windows.
-Steve