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

Re: getting head: illegal line count -- -31



In this case the values are hardcoded, so Colin was just warning about the off-by-one counting difference between these two (functionally identical) commands:
head -n -31
tail -n +32


On 16 August 2014 12:00, Chris Moore <christopher.ian.moore@gmail.com> wrote:
You mean $((X+1)), not $(X+1), right?

$ X=42
$ echo $(X+1)
No command 'X+1' found, did you mean:
 Command 'X11' from package 'x11-common' (main)
X+1: command not found

$ echo $((X+1))
43



On Fri, Aug 15, 2014 at 5:31 PM, Bob <lion@mtnlion.com> wrote:

On 8/15/2014 10:52 AM, Bob wrote:

On 8/15/2014 9:47 AM, Colin Percival wrote:
[CCing Alex since it's his code we're talking about here...]

On 08/15/14 09:19, Bob wrote:
On 8/14/2014 4:55 PM, Colin Percival wrote:
On 08/14/14 14:55, Bob wrote:
I am running ACTS to do my backups and cleanup my archive. Everything was fine
for a month or so, now I get "

head: illegal line count -- -31" at the end of the tarsnap backup. As far as I
can tell, everything is still being backed up, but this message must mean
something. Can anyone help?
That would be a problem with the script you're using -- looks like it's in the
part of the script which deletes old daily backups.  The "-n negative number"
option to the head utility is nonportable and presumably doesn't exist on your
operating system.

That makes sense. I am using freeBSD 9.2. The only thing is that daily backup
removal was going fine for a while. I am not an expert at this. Is there a fix
or a different way to attack backup management?
Probably you never had an error earlier because you had less than 31 daily
backups and so none of them needed to be deleted.

I think the easiest solution here is for 'head -n -X' to be replaced by
'sort -rn | tail +$(X+1)' -- Alex, do you want to make this change?

Thanks so much for the fix!

I spoke too soon. Now, when I run acts.sh (after changing the lines for head), I get "

/var/run/acts exists referencing PID <none>, aborting!"

Seems odd.