Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 44 lines (33 sloc) 851 Bytes
#!/bin/bash
# select files and directories (like "open", except that it selects its arguments,
# instead of opening them).
#
# $ select *.jpg
if [ $# == 0 ]; then
echo "usage: $(basename $0) args"
exit
fi
# NOTE: Remove redirect when debugging! http://stackoverflow.com/q/11902524/11543
/usr/bin/osascript - "$@" << END 2>&1 | grep -v CFURLGetFSRef
on run argv
set errorString to ""
set fileList to {}
repeat with s in argv
try
set end of fileList to (alias (POSIX file s))
on error
# Patterned after the "open" error message
set errorString to errorString & "The file " & s & " does not exist."
end try
end repeat
if not fileList = {}
tell application "Finder"
reveal fileList
activate
end tell
end if
if not errorString = ""
return errorString
end if
end run
END
You can’t perform that action at this time.