Skip to content

Commit ae055f6

Browse files
committed
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)
1 parent 02d03e7 commit ae055f6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

trash

+6-5
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
#
77
# v0.1 2007-05-21 - Morgan Aldridge <morgant@makkintosshu.com>
88
# Initial version.
9-
# v0.2 2010-10-25 - Morgan Aldridge
9+
# v0.2 2010-10-26 - Morgan Aldridge
1010
# Use appropriate .Trashes folder when trashing files
1111
# on other volumes. Create trash folder(s) if necessary.
12+
# v0.2.1 2010-10-26 - Morgan Aldridge
13+
# No longer using bash built-in regexp support in hopes
14+
# of support Mac OS X 10.4 and earlier.
1215
#
1316

1417
# TO DO:
@@ -52,10 +55,8 @@ if [ $# -gt 0 ]; then
5255
if $verbose; then v="-v"; fi
5356
# determine whether we should be putting this in a volume-specific .Trashes or user's .Trash
5457
if [ "${1:0:9}" = "/Volumes/" -o "${1:0:9}" = "/Volumes/" ]; then
55-
if [[ "$1" =~ ^/Volumes/([^/]+) ]]; then
56-
vol="${BASH_REMATCH[1]}"
57-
trash="/Volumes/${vol}/.Trashes/${uid}/"
58-
fi
58+
IFS=/ read -r -d '' _ _ vol _ <<< "$1"
59+
trash="/Volumes/${vol}/.Trashes/${uid}/"
5960
else
6061
trash="/Users/${user}/.Trash/"
6162
fi

0 commit comments

Comments
 (0)