view build-aux/move-if-change @ 20515:ad7fe3cb6fd2

pkg: fix regression on output of pkg list (bug #45873) * scripts/pkg/pkg.m: cset 7fa1970a655d reduced the checks to nargout to is there nargout or not. However, the subfunction installed_packages() returns alternative things based on its own nargout (it probably should not since that makes for a messy code). Fix, pkg to call the subfunction correctly based on its nargout too (but still, use "nargout > 1" instead of "nargout == 2". * scripts/pkg/private/installed_packages.m: do not check for exact number of nargout and reduce number of function return points.
author Carnë Draug <carandraug@octave.org>
date Fri, 04 Sep 2015 18:47:54 +0100
parents 5e50f25f245a
children
line wrap: on
line source

#!/bin/sh
#
# Like mv $1 $2, but if the files are the same, just delete $1.
# Status is 0 if $2 is changed, 1 otherwise.

if test -r $2; then
  if cmp $1 $2 > /dev/null; then
    echo $2 is unchanged 1>&2
    rm -f $1
  else
    mv -f $1 $2
  fi
else
  mv -f $1 $2
fi