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

Re: Script does not do what it is told to do



On 25/10/2019 16:37, David Wright wrote:
On Fri 25 Oct 2019 at 14:28:02 (+0100), Michael Howard wrote:
On 25/10/2019 14:11, Greg Wooledge wrote:
On Fri, Oct 25, 2019 at 08:33:09AM +0100, Michael Howard wrote:
On 24/10/2019 23:37, Ken Heard wrote:
#!/bin/bash
# Script to back up all browser files in directory /home/ken/mozilla.
STARTDIR=$PWD
cd /home/ken
tar -czf /media/fde/backups/kbrowsers.tgz  --exclude-caches \
- --wildcards -T docs/tarlists/kbrowsers.lst
cd "$STARTDIR"
There is nothing inherently wrong with the script,
Untrue.  I pointed out the flaws last time this subject was discussed
on this mailing list.  Was that just a few days ago, or was it last
week?  I don't remember.
Sorry, but it _is_ true. One can't know, nor should one, if the
variables and paths are correct, but if they are, i.e. all things
being equal, the script  is inherrently correct. Of course, it
certainly isn't optimal.
What's the role of the hyphen between the two --switches, please.

in that it would work if
all other things were equal, but they are clearly not.
Lots of scripts will work "if certain conditions hold true".
See above.
If one "shouldn't know" about such conditions, then it seems pointless
to post this sort of problem on the list. One is better employed in
checking one's own assumptions, as Thomas has shown elsewhere in the
thread.

That's the
fundamental problem here.  The script shown here is incredibly fragile,
and the author did not correct the flaws that I already pointed out
last time.  It may "work" under certain conditions.  How likely those
conditions are to be true, I have no way to know.
I have no idea about when or where the OP may have posted previously.
Four days ago, on this list. Looking back to check the date, I see
that the said hyphen had a different, but equally mysterious, role
in the OP's script back there. Perhaps you could explain that hyphen
at the same time.

https://lists.debian.org/debian-user/2019/10/msg00758.html

Using the -C option to tar is preferable to the way you are doing it.
Yup, that was one of the three(?) proposals I made last time around,
none of which were followed.  *shrug*  Not much more I can do when
nobody listens to me.
With your attitude, little wonder nobody listens to you. You're
probably on the ignore list :)
That might explain some of the scripts seen here. I find Greg's
comments on scripts very valuable, and they often remind me to
check out the pages at http://mywiki.wooledge.org/BashGuide.
It would be exaggerating to say that I wait with bated breath for
Greg's comments whenever I post a script here myself.

Greg's criticism's are far more useful than some of the immaterial
English corrections I've seen here.

Cheers,
David.

Well good for you. Nice to see Greg as a bodyguard.

plonk!

In case you don't know and to save you the time replying, that was the sound of you hitting the kill file.

Mike.

--



Reply to: