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

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



Ken Heard <ken@heard.name> writes:

> Whenever I run this script -- or several others like it
>
> #!/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"
>
> it returns the following:
>
> ken@Turing:~$ tarkbrowsers
> tar (child): /media/ssda/backups/kbrowsers.tgz: Cannot open: No such
> file or directory
> tar (child): Error is not recoverable: exiting now
> tar: /media/ssda/backups/kbrowsers.tgz: Cannot write: Broken pipe
> tar: Child returned status 2
> tar: Error is not recoverable: exiting now
>
> It is trying to save the tarball to a different portable storage
> device, ssda, which had failed and consequently is no longer in
> /etc/fstab.  How could such a thing happen?
>

Please check the output of these commands:

which tarkbrowsers
cat $(which tarkbrowsers)

I suspect your invocation is not running the version of the script you
expect.

> However, if I pull the line with the tar command out of the script and
> running it independently it does what it is told.  If there is
> something wrong with the script I can't find it.
>
> I also tried the script with the second line reading STARTDIR="$PWD";
> but that change made no difference, the result was the same.
>

Try adding an "echo here" line at the beginning of the script and seeing
if that shows up.  If not, then you know for certain you are not running
what you think you are.

-- 
regards,
kushal


Reply to: