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

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

On 2019-10-26 at 21:33, Ken Heard wrote:

> The tar scripts now look like this.
> -------------------------------------------------------
> #!/bin/bash
> # Script to back up all browser files in directory /home/ken/mozilla.
> echo here
> tar -cpzf /media/fde/backups/kbrowsers.tgz  --exclude-caches
> --wildcards -T docs/tarlists/kbrowsers.lst
> -------------------------------------------------------
> This one exceptionally has 'echo here" above the tar command at the
> suggestion of Kushal Kumeran.

Where is this script located (full path and filename)?

If I'm reading things right, you also might want to either put the 'cd
/home/ken' line back (no need for the other cd), or use the full path to
kbrowsers.lst instead of a relative path; otherwise this won't work
right if you run it from any directory which doesn't have that relative
path under it.

(If kbrowsers.lst has relative paths in it, this might not work
correctly from another location without the cd anyway, even if you do
use a full path on the command line. I don't have experience with that
tar feature myself.)

> Also at his request I ran the following two commands:
> 'which tarkbrowsers' which returned '/home/ken/bin/tarkbrowsers', and
> 'cat $(which tarkbrowsers)' which returned
> -------------------------------------------------------
> # Script to back up all browser files in directory /home/ken/mozilla.
> cd /home/ken
> tar -czf /media/ssda/backups/kbrowsers.tgz  --exclude-caches
> --wildcards -T docs/tarlists/kbrowsers.lst
> cd $CURPWD
> -------------------------------------------------------
> As this return includes the change of directories commands it is clear
> that somewhere there is a series of extraneous scripts but the
> software is being coy about telling me where they are.

Eh? No, it isn't. It already told you clearly that this latter script is

Your mail doesn't (seem to?) give us enough information for us to
identify where the former of the two given scripts is, but presumably
you know where to find that one, since you were able to give its
contents here.

If you don't want to run this latter version of the script, either move
it out of its current directory (which is apparently in your PATH), or
replace it with the version you do want to run.

(I'm presuming that the newline between '--exclude-caches' and
'--wildcards' in each script is an artifact of the mail process, and not
present in the actual on-disk script. If it *is* present there, then
these are both going to break and not do what you expect.)

   The Wanderer may regret sending this, if recent history is any guide

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man.         -- George Bernard Shaw

Attachment: signature.asc
Description: OpenPGP digital signature

Reply to: