Commit e783556e authored by Aron Griffis's avatar Aron Griffis

dotglob FTW. Doesn't expand . or .. but be explicit just in case.

parent 5f96190e
......@@ -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|.|..)
)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment