awesome-osx-command-line/functions.md
2015-12-04 00:21:31 +01:00

1.1 KiB

Functions

An assorted collection of useful OS X specific Bash-style functions. Part of Awesome OS X Command Line.

Table of Contents

Finder

Get Path of Frontmost Finder Window

function finder_path {
    osascript -e 'tell application "Finder"'\
        -e "if (${1-1} <= (count Finder windows)) then"\
        -e "get POSIX path of (target of window ${1-1} as alias)"\
        -e 'else' \
        -e 'get POSIX path of (desktop as alias)'\
        -e 'end if' \
        -e 'end tell';
}

License

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.