Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.73 KB | None | 0 0
  1. #!/bin/sh
  2. # Made by:
  3. # $0 DESTDIR LINK_TARGET
  4. case ${2?} in [^/]*) set -- "$1" "$PWD/$2" ;; esac
  5. case $1 in [^/]*) set -- "$PWD/$1" "$2" ;; esac
  6.  
  7. /usr/bin/find -L "$1" -samefile "$2" -not -wholename "$2" -print0 |
  8. /usr/bin/xargs -0 /bin/rm
  9.  
  10. exit $?
  11. test ! -L "${2?}" && find "$1" -type l -exec test "$2" -ef {} \; -delete
  12.  
  13.  
  14. ### And adopted version ###
  15. #!/bin/sh
  16. # Made by: xx
  17.  
  18. [ -z "$2" ] && DIALOG=true || DIALOG=false
  19. while $DIALOG
  20. do
  21.    echo -n "Input dir: " ;read dir
  22.    echo -n "Input file: " ;read file
  23.    set -- "$dir" "$file"
  24.    echo -n "Dir=[$1] File=[$2]. Run [no]? " ;read ans
  25.    case $ans in [yY][eE][sS]) DIALOG=false ;;esac
  26. done
  27.  
  28. [ ! -L "$2" ] && find "$1" -type l -exec test "$2" -ef {} \; -delete
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement