-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaced bash regex usage in 'trash' (which requires bash 3.0+, first…
… included in Mac OS X 10.5 Leopard) with a call to read w/IFS. Added v0.2.1 release notes & fixed date for v0.2 release. (Issue #158)
- Loading branch information
Showing
1 changed file
with
6 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,12 @@ | |
# | ||
# v0.1 2007-05-21 - Morgan Aldridge <[email protected]> | ||
# Initial version. | ||
# v0.2 2010-10-25 - Morgan Aldridge | ||
# v0.2 2010-10-26 - Morgan Aldridge | ||
# Use appropriate .Trashes folder when trashing files | ||
# on other volumes. Create trash folder(s) if necessary. | ||
# v0.2.1 2010-10-26 - Morgan Aldridge | ||
# No longer using bash built-in regexp support in hopes | ||
# of support Mac OS X 10.4 and earlier. | ||
# | ||
|
||
# TO DO: | ||
|
@@ -52,10 +55,8 @@ if [ $# -gt 0 ]; then | |
if $verbose; then v="-v"; fi | ||
# determine whether we should be putting this in a volume-specific .Trashes or user's .Trash | ||
if [ "${1:0:9}" = "/Volumes/" -o "${1:0:9}" = "/Volumes/" ]; then | ||
if [[ "$1" =~ ^/Volumes/([^/]+) ]]; then | ||
vol="${BASH_REMATCH[1]}" | ||
trash="/Volumes/${vol}/.Trashes/${uid}/" | ||
fi | ||
IFS=/ read -r -d '' _ _ vol _ <<< "$1" | ||
trash="/Volumes/${vol}/.Trashes/${uid}/" | ||
else | ||
trash="/Users/${user}/.Trash/" | ||
fi | ||
|