diff --git a/bin/utils b/bin/utils index 19af53de3fc777fc14912394cb8afe3237e699ef..ac94949fcfbdcbfc3c04934f29c3345df4ba4d15 100755 --- a/bin/utils +++ b/bin/utils @@ -46,10 +46,10 @@ deep-cp() { # cp doesn't like being called without source params, # so make sure they expand to something first. - # subshell to avoid surprising caller with nullglob. + # subshell to avoid surprising caller with shopts. ( - shopt -s nullglob - set -- "$source"/!(tmp) "$source"/.{[!.],.?}* + shopt -s nullglob dotglob + set -- "$source"/!(tmp|.|..) [[ $# == 0 ]] || cp -a "$@" "$target" ) } @@ -62,7 +62,11 @@ deep-mv() { # Does some serious deleting. deep-rm() { - rm -rf "$1"/!(tmp) "$1"/.{[!.],.?}* + # subshell to avoid surprising caller with shopts. + ( + shopt -s dotglob + rm -rf "$1"/!(tmp|.|..) + ) }