Re: Need refinement to minimal-bash-script



On Sun, 30 Dec 2007 15:04:20 +0100 (CET), s. keeling wrote:
problems@gmail <problems@gmail>:
With previous help from contributors to this group, I've got
a script which reads the URLs from a file and dumps/appends
the [lynx] contents to a file, for reading off-line.
Here's the script-line which has been working well:
#
#!/bin/bash
for url in `cat NewsLst`; do lynx -dump "$url" >> accumNewsLst; done

So now I want to avoid having to add the URL as a header and
a "<><><>..." as a end-marker for each fetch which is appended to
the accumulating-file. Here's my failed attempt:

for url in `cat urls.txt`; do
echo "<><><><><>" >> accumulation;
"$url" >> accumulation;
echo " == blank line ==" >> accumulation;
lynx -dump "$url" >> accumulation; done

for url in `cat urls.txt`; do
echo >> accumulation # bare echo == newline
echo "$url" >> accumulation # added "echo"
echo >> accumulation
lynx -dump "$url" >> accumulation
echo >> accumulation
echo '<><><><><>' >> accumulation # single ticks.
done

BTW, bash also has printf, which may help consolidate the mess.

printf '\n%s\n' $url >> accumulation

replaces the first three echos.

Allow me to suggest adding "-nolist" to the lynx command.
Would seem to be applicable in the OP's case.

Jonesy
--
Marvin L Jones | jonz | W3DHJ | linux
38.24N 104.55W | @ config.com | Jonesy | OS/2
*** Killfiling google posts: <http://jonz.net/ng.htm>
.



Relevant Pages

  • Re: Need refinement to minimal-bash-script
    ... a script which reads the URLs from a file and dumps/appends ... echo>> accumulation ... BTW, bash also has printf, which may help consolidate the mess. ...
    (comp.os.linux.misc)
  • Re: Getting User Input in BASH Script without using Read.
    ... My script can't wait for a second or even half a second; ... I assume that the 'clock ... Accumulation of this 'drag' leads to 'discrepancy' on the screen. ... there's the problem of the display of the 'timer' variable of the ...
    (comp.unix.shell)