From dac2a6e27a23071226495bfee54b390135cb20b6 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Wed, 20 Aug 2014 23:52:05 +0200 Subject: Replace /usr/bin/env with env Some environments (such as Android) does not have /usr/bin. --- lib/functions.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/functions.zsh') diff --git a/lib/functions.zsh b/lib/functions.zsh index fda84a953..17f5f9cbf 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -3,11 +3,11 @@ function zsh_stats() { } function uninstall_oh_my_zsh() { - /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh + env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh } function upgrade_oh_my_zsh() { - /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh + env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh } function take() { -- cgit v1.2.3-70-g09d2 From 2d0bfcf81846ea4cb0fe2a42f3dac7f2c60e77b7 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 5 Aug 2015 00:27:51 +0200 Subject: Implement cross-platform open function open_command() For now this supports: - Mac OS X - Linux (presumably works on all versions) - Cygwin (Windows) --- lib/functions.zsh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/functions.zsh') diff --git a/lib/functions.zsh b/lib/functions.zsh index 17f5f9cbf..0d632a268 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -15,6 +15,22 @@ function take() { cd $1 } +function open_command() { + local open_cmd + + # define the open command + case "$OSTYPE" in + darwin*) open_cmd="open" ;; + cygwin*) open_cmd="cygstart" ;; + linux*) open_cmd="xdg-open" ;; + *) echo "Platform $OSTYPE not supported" + return 1 + ;; + esac + + nohup $open_cmd "$@" &>/dev/null +} + # # Get the value of an alias. # -- cgit v1.2.3-70-g09d2