function linkup() { local component=$1 shift #do core for rk in $*; do if [ ! -e "../$rk/$component" ]; then ln -s "../shared/$component" "../$rk" fi done } #check they all exist first for rk in lirk2 wirk2 mark2 rk3 sork2 sork3 derk cdrk2; do if [ ! -d "../$rk" ]; then echo "$rk not present" some_not_present=true fi done if [ "$some_not_present" == "true" ]; then exit fi linkup core rk3 lirk2 wirk2 mark2 sork2 sork3 derk cdrk2 linkup greenstone2 lirk2 wirk2 mark2 sork2 cdrk2 linkup greenstone3 rk3 sork3 linkup linux rk3 lirk2 mark2 sork2 sork3 derk cdrk2 linkup windows rk3 wirk2 sork2 sork3 cdrk2 linkup mac rk3 mark2