From c28a41e4999fe7f9f85caa4ea85958298d8e89f2 Mon Sep 17 00:00:00 2001 From: Andrew Lorimer Date: Thu, 16 Aug 2018 21:52:13 +1000 Subject: [PATCH 1/1] handy features for zsh on larry --- autocifs.sh | 11 +++++++++++ macopen.sh | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100755 autocifs.sh create mode 100755 macopen.sh diff --git a/autocifs.sh b/autocifs.sh new file mode 100755 index 0000000..cccbc71 --- /dev/null +++ b/autocifs.sh @@ -0,0 +1,11 @@ +#! /bin/bash + +# +# Automatically mount samba share on charles.cortex when connected to cortex-lab +# + +ssid=$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | sed -e "s/^ *SSID: //p" -e d) + +if [[ $ssid == cortex-lab ]]; then + osascript -e 'mount volume "smb://andrew@charles/andrew"' +fi diff --git a/macopen.sh b/macopen.sh new file mode 100755 index 0000000..51d2746 --- /dev/null +++ b/macopen.sh @@ -0,0 +1,21 @@ +#! /bin/bash + +#include +#include + +exe=$1 +files=${@:2} +path='' + +resolve() { + path=$(realpath $1) + echo $1 +} + +#$(open -a $1 + +for f in $files +do + open -a $exe $(resolve $f) + echo $(resolve $f) +done -- 2.47.0