summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClint Adams <clint@debian.org>2012-11-11 11:14:17 -0500
committerClint Adams <clint@debian.org>2012-11-11 11:14:17 -0500
commit603ab8b2d39a2a1f8bb19df2f8aae3cd1b56d269 (patch)
treec7359d95cdeb33ef217083e4de382d3c2242f543
parentb1bb4001b68271ac69a121e8ce0f5b34a315e1ef (diff)
downloaddebianutils-603ab8b2d39a2a1f8bb19df2f8aae3cd1b56d269.tar.gz
savelog: patch from Bob Proulx to silence ls error message with savelog -C. closes: #653940.
-rw-r--r--savelog10
1 files changed, 8 insertions, 2 deletions
diff --git a/savelog b/savelog
index 1a0f305..33b91f0 100644
--- a/savelog
+++ b/savelog
@@ -299,9 +299,15 @@ while [ $# -gt 0 ]; do
if [ -n "$forceclean" ]; then
cycle=$(( $count - 1))
if [ -z "$COMPRESS" ]; then
- rm -f -- `ls -t -- $newname.[0-9]* | sed -e 1,${cycle}d`
+ list=$(ls -t -- $newname.[0-9]* 2>/dev/null | sed -e 1,${cycle}d)
+ if [ -n "$list" ]; then
+ rm -f -- $list
+ fi
else
- rm -f -- `ls -t -- $newname.[0-9]*$DOT_Z | sed -e 1,${cycle}d`
+ list=$(ls -t -- $newname.[0-9]*$DOT_Z 2>/dev/null | sed -e 1,${cycle}d)
+ if [ -n "$list" ]; then
+ rm -f -- $list
+ fi
fi
fi