Created
August 24, 2020 01:10
-
-
Save jpmhouston/4e23e60767055f98fccfee956eef9eda to your computer and use it in GitHub Desktop.
Fish shell function that outputs linefeed delimited paths of the finder selection
This file contains hidden or 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
# 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" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment