Guest User

Untitled

a guest
Jun 22nd, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. for src in $(find -H "$DOTFILES_ROOT" -maxdepth 2 -name '*.sym' -not -path '*.git*')
  2. do
  3. dst="$HOME/$(basename "${src%.*}")"
  4. link_file "$src" "$dst"
  5. done
  6.  
  7. For loops over find output are fragile. Use find -exec or a while read loop.
  8.  
  9. find -H "$(pwd)" -maxdepth 2 -name '*.sym' -not -path '*.git*' -exec echo {} ;
  10.  
  11. find -H "$DOTFILES_ROOT" -maxdepth 2 -type d -name '.git' -prune -o
  12. -type f -name '*.sym' -exec sh -c '
  13. link_file "$1" "$HOME/$( basename "${1%.*}" )"' sh {} ';'
  14.  
  15. find -H "$DOTFILES_ROOT" -maxdepth 2 -type d -name '.git' -prune -o
  16. -type f -name '*.sym' -exec sh -c '
  17. for src do
  18. dst="$HOME/$( basename "${src%.*}" )"
  19. link_file "$src" "$dst"
  20. done' sh {} +
Add Comment
Please, Sign In to add comment