Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
executable file 45 lines (34 sloc) 869 Bytes
#!/usr/bin/env 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
exit 0