Nick LeRoy <nleroy@cs.wisc.edu> [Fri, 5 Sep 2003 08:27:22 -0500]:
#!/bin/sh cd $1; tar cf - . | ( cd $2; tar xpfS - )
Quite :) I'd change it so: #!/bin/bash if [ ! -z "$1" -a ! -z "$2" -a "$1" != "$2" ]; then tar -C $1 -cSp --numeric-owner --atime-preserve -f - . | \ ( tar -C $2 -xSpv --atime-preserve -f - ) else echo "One or both of source and target directory is missing" echo "or source and target are identical" exit 1 fi or, as function tarx() { if [ ! -z "$1" -a ! -z "$2" -a "$1" != "$2" ]; then tar -C $1 -cSp --numeric-owner --atime-preserve -f - . | \ ( tar -C $2 -xSpv --atime-preserve -f - ) else echo "One or both of source and target directory is missing" echo "or source and target are identical" fi } See 'man tar' for a description of the tar options used and 'man test' for a description of the test options used. Philipp