mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
dotglob FTW. Doesn't expand . or .. but be explicit just in case.
This commit is contained in:
@@ -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|.|..)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user