relndir 298 B

12345678910111213141516
  1. #!/bin/sh
  2. if [ ! -L "$2" ]; then
  3. ln -sFfh ./ "$2"
  4. fi
  5. if [ ! -d "$1" ]; then
  6. echo "$0: $1 does not exist"
  7. exit 1
  8. fi
  9. while true; do
  10. RND=`rnd`
  11. if [ -e "$2.$RND" ]; then continue; fi
  12. mv "$1" "$2.$RND"
  13. ln -sFfh "$2.$RND" "$2"
  14. ls -d "$2".* | grep -v "$2.$RND" | xargs rm -rf
  15. break
  16. done