From 2074d145c9d8953e05d9182d80d41e05861d2e4d Mon Sep 17 00:00:00 2001 From: Marcel Bischoff Date: Fri, 4 Dec 2015 00:21:31 +0100 Subject: [PATCH] Add functions.md and category --- README.md | 6 ++++++ functions.md | 30 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 functions.md diff --git a/README.md b/README.md index edc3c8a..b776f12 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ For more terminal shell goodness, please also see this list's sister list [Aweso - [Metadata Files](#metadata-files) - [Opening Things](#opening-things) - [Fonts](#fonts) +- [Functions](#functions) - [Hardware](#hardware) - [Hardware Information](#hardware-information) - [Power Management](#power-management) @@ -611,6 +612,11 @@ atsutil server -ping ``` +## Functions + +Please see [this file](functions.md). + + ## Hardware ### Hardware Information diff --git a/functions.md b/functions.md new file mode 100644 index 0000000..d3790f8 --- /dev/null +++ b/functions.md @@ -0,0 +1,30 @@ + + +# Functions + +> An assorted collection of useful OS X specific Bash-style functions. Part of [Awesome OS X Command Line](https://github.com/herrbischoff/awesome-osx-command-line). + +## Table of Contents + +- [Finder](#finder) + + +## Finder + +### Get Path of Frontmost Finder Window +```bash +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.