[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: A Bit of a Strange Situation



On 2011-08-26, RiverWind <riverwind@shellworld.net> wrote:
>
> If I am not mistaken, in order to run any script, it must be saved
> in a certain format. How is that done?
>

I just tried the following out and it seems to work quite well
(from Bob and Shane).

curty@einstein:~$ file=cookbook.txt
curty@einstein:~$ for chapternum in $(seq 1 45); do 
curl http://www.dsl.org/cookbook/cookbook_$chapternum.html | html2text >> $file; 
done

I just typed it all out at the command line as the command in its
present form seems to be more a less a one shot deal.  If you wanted to
make a script out of it, you'd put the following in a file, let's say
"get_cooking.sh":

 #!/bin/bash
 file=cookbook.txt
 for chapternum in $(seq 1 45); do 
 curl http://www.dsl.org/cookbook/cookbook_$chapternum.html | html2text >> $file;
 done

Then make the file executable:

chmod +x get_cooking.sh

Then you either run it by typing "./get_cooking.sh" in the directory where
"get_cooking.sh" is located, or you put the file somewhere in your path
(I believe /usr/local/bin would be appropriate), and simply type
"get_coodking.sh" at the command line.

Anyway, I'm pretty ignorant and should've let somebody else pick up the
ball!


Reply to: