#!/bin/bash RSYNC=$1 if [ -z "$RSYNC" ]; then RSYNC=/home/wayne/src/rsync/rsync fi if [ ! -d /tmp/X1/data ];then mkdir -p /tmp/X1/data cd /tmp/X1/data for file in {1..100}; do dd if=/dev/zero of=./$file bs=1k count=16; done fi cd /tmp/X1 for num in {1..9}; do if [ ! -d data_hl$num ]; then rsync -av --hard-links --link-dest=/tmp/X1/data/ data/ data_hl$num/ fi done cd /tmp # without this, there are no errors (unless /tmp/X2 exists). $RSYNC -av --hard-links --dry-run /tmp/X1/ /tmp/X2/