Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Fish shell function that outputs linefeed delimited paths of the finder selection
# Useful to refer to finder selections from the fish shell command line, like:
# $ file (selection)
# /Users/me/Documents/Files/Throwback.dvtcolortheme: XML 1.0 document text, ASCII text
# /Users/me/Documents/Files/Test.sparsebundle/: directory
function selection
osascript -e "tell application \"Finder\" to set s to the selection as alias list" -e "repeat with f in s" -e "set contents of f to POSIX path of f" -e "end repeat" -e "set AppleScript's text item delimiters to linefeed" -e "s as string"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment