X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=tar-copy.sh;h=3df1bc11169e6a77f178abca7ec733dbb092c3ea;hp=4e45bc34ed3314dd481734e994970d324bd7959c;hb=b94faec6aab7c3613c1e7d217f6df6f42d929234;hpb=661078ddbde3ce0f3b06e95642fbb9b5fef7dca1 diff --git a/tar-copy.sh b/tar-copy.sh index 4e45bc34..3df1bc11 100755 --- a/tar-copy.sh +++ b/tar-copy.sh @@ -1,7 +1,7 @@ #!/bin/sh -# $Id: tar-copy.sh,v 1.3 1998/02/11 12:14:03 tom Exp $ +# $Id: tar-copy.sh,v 1.5 2003/10/25 14:40:07 tom Exp $ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998,2003 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -28,7 +28,7 @@ # authorization. # ############################################################################## # -# Author: Thomas E. Dickey 1997,1998 +# Author: Thomas E. Dickey # # Copy a collection of files using 'tar', so that their dates and links are # preserved @@ -55,16 +55,23 @@ fi WD=`pwd` TMP=$WD/copy$$ -trap "rm -f $TMP" 0 1 2 5 15 cd $2 -if ( tar cf $TMP $1 ) +TEST=`ls -d $1 2>/dev/null` +if test -z "$TEST" then - cd $3 - LIST=`tar tf $TMP 2>&1` - $DOIT rm -rf $LIST 2>/dev/null - $DOIT tar xvf $TMP + echo "... no match for \"$1\" in $2" else - echo "Cannot create tar of $1 files" - exit 1 + echo "... installing files matching \"$1\" in $2" + trap "rm -f $TMP" 0 1 2 5 15 + if ( tar cf $TMP $1 ) + then + cd $3 + LIST=`tar tf $TMP 2>&1` + $DOIT rm -rf $LIST 2>/dev/null + $DOIT tar xvf $TMP + else + echo "Cannot create tar of $1 files" + exit 1 + fi fi