Gentoo Archives: gentoo-user

From: Tanstaafl <tanstaafl@×××××××××××.org>
To: gentoo-user@l.g.o
Subject: [gentoo-user] "rm: missing operand" in emailed result of cron job that uses rm to remove aged files
Date: Mon, 20 Jan 2014 11:39:21
Message-Id: 52DD0AC0.7050207@libertytrek.org
1 Hi all,
2
3 I've got a cron job that runs a mysqldump script, and the last part of
4 that script removes the oldest of the files in the backup_dir.
5
6 The pertinent part of the script is:
7
8 > # delete aged backup files, keeping 60 nightlies and 45 (5 days of) hourlies
9 > rm $(ls -1t $MySQL_BACKUP_DIR_nightly/* | tail -n +61)
10 > rm $(ls -1t $MySQL_BACKUP_DIR_hourly/* | tail -n +46)
11
12 It works fine and does what it is supposed to, but the email I get as a
13 result of the script running says only this in the body:
14
15 rm: missing operand
16 Try 'rm --help' for more information.
17 rm: missing operand
18 Try 'rm --help' for more information.
19
20 Like I said, the oldest files do actually get deleted, so apparently
21 these messages are harmless, but why do I get them, and is there
22 something I can do to 'fix' the script so I don't?
23
24 Thx
25
26 Charles

Replies