- #!/bin/sh
- if [ ! -L "$2" ]; then
- ln -sFfh ./ "$2"
- fi
- if [ ! -d "$1" ]; then
- echo "$0: $1 does not exist"
- exit 1
- fi
- while true; do
- RND=`rnd`
- if [ -e "$2.$RND" ]; then continue; fi
- mv "$1" "$2.$RND"
- ln -sFfh "$2.$RND" "$2"
- ls -d "$2".* | grep -v "$2.$RND" | xargs rm -rf
- break
- done
|