replaced env vars with isMac / isLinux

pull/2/head
Hari Sekhon 5 years ago
parent c3111e2ebe
commit db55c9e069

@ -106,7 +106,7 @@ alias clhist='HISTSIZE=0; HISTSIZE=5000'
alias nohist='unset HISTFILE'
export LS_OPTIONS='-F'
if [ -n "${APPLE:-}" ]; then
if isMac; then
export CLICOLOR=1 # equiv to using -G switch when calling
else
export LS_OPTIONS="$LS_OPTIONS --color=auto"
@ -236,7 +236,7 @@ alias tg='traceroute www.google.com'
# using variable and single alias definition to work around my bash duplicate defs auto checks which would flag the same alias defined twice in two different files, even if only one is sourced depending on the OS
if [ -n "$APPLE" ]; then
if isMac; then
clipboard=pbcopy
else
clipboard=xclip

@ -25,7 +25,7 @@ bash_tools="${bash_tools:-$(dirname "${BASH_SOURCE[0]}")/..}"
# shellcheck disable=SC1090
. "$bash_tools/.bash.d/os_detection.sh"
[ -n "${APPLE:-}" ] || return
isMac || return
# put in inputrc for readline
#set completion-ignore-case on

@ -62,7 +62,7 @@ export varfile=~/.bash_vars
# ============================================================================ #
if [ -n "$APPLE" ]; then
if isMac; then
#BROWSER=open
unset BROWSER
elif type -P google-chrome &>/dev/null; then
@ -81,7 +81,7 @@ fi
# don't export BROWSER on Mac, trigger python bug:
# AttributeError: 'MacOSXOSAScript' object has no attribute 'basename'
# from python's webbrowser library
if [ -z "$APPLE" ]; then
if ! isMac; then
export BROWSER
fi

@ -63,7 +63,7 @@ bell_done(){
resolve_symlinks(){
local readlink=readlink
if [ -n "$APPLE" ]; then
if isMac; then
if type -P greadlink &>/dev/null; then
readlink=greadlink
else
@ -169,7 +169,7 @@ ptop(){
#pids="$(pgrep -f "$(sed 's/ /|/g' <<< "$*")")"
pids="$(pgrep -f "${*// /|}")"
local pid_args
if [ -n "$APPLE" ]; then
if isMac; then
# shellcheck disable=SC2001
pid_args="$(sed 's/^/-pid /' <<< "$pids")"
else
@ -365,7 +365,7 @@ wcbash(){
}
epoch2date(){
if [ -n "$APPLE" ]; then
if isMac; then
date -r "$1"
else
date -d "@$1"
@ -381,7 +381,7 @@ pdf(){
echo "file not found: $1"
return 1
fi
if [ -n "$APPLE" ]; then
if isMac; then
open "$1"
return $?
fi

@ -25,7 +25,7 @@ bash_tools="${bash_tools:-$(dirname "${BASH_SOURCE[0]}")/..}"
export CLASSPATH="$CLASSPATH:$HOME/bin/java"
if [ -n "${APPLE:-}" ]; then
if isMac; then
mac_export_java_home(){
local version="$1"
local args

@ -26,7 +26,7 @@ bash_tools="${bash_tools:-$(dirname "${BASH_SOURCE[0]}")/..}"
# shellcheck disable=SC1090
. "$bash_tools/.bash.d/os_detection.sh"
[ -n "$APPLE" ] && return
isLinux || return
alias reloadXdefaults="xrdb ~/.Xdefaults"
@ -36,7 +36,7 @@ alias reloadXdefaults="xrdb ~/.Xdefaults"
# TODO: change this to keysym as keycodes can change between keyboards, to find keymaps do
# xmodmap -pkie
if [ -n "$DISPLAY" ] && [ -z "${APPLE:-}" ]; then
if [ -n "$DISPLAY" ] && ! isMac; then
# This caused the left to be remapped, must test and handle better
#xmodmap -e 'keycode 113 = Pointer_Button2'
#xmodmap -e 'keycode 113 = Left NoSymbol Left'

@ -30,7 +30,7 @@ alias 4="ping 4.2.2.1"
#alias p=ping
pingwait="-w"
[ "${APPLE:-}" ] && pingwait="-W"
isMac && pingwait="-W"
checkhost(){
if [ -z "$1" ]; then
@ -162,7 +162,7 @@ whatismyip(){
browser(){
if [ -n "$BROWSER" ]; then
"$BROWSER" "$@"
elif [ -n "$APPLE" ]; then
elif isMac; then
open "${*:-http://google.com}"
else
echo "\$BROWSER environment variable not set and not on Mac OSX, not sure which browser to use, aborting..."
@ -188,7 +188,7 @@ isupme(){
}
chrome(){
if [ -n "$APPLE" ]; then
if isMac; then
# opens in most recent Chrome window
# could use one of these: --new --args --incognito --new-window
open -a 'Google Chrome' "${*:-http://www.google.com}"
@ -200,7 +200,7 @@ chrome(){
}
ff(){
if [ -n "$APPLE" ]; then
if isMac; then
open -a 'Firefox' "http://${*:-www.google.com}"
else
checkprog firefox || return 1
@ -283,7 +283,7 @@ retry(){
rdp(){
if [ -n "$APPLE" ]; then
if isMac; then
"/Applications/Remote Desktop Connection.app/Contents/MacOS/Remote Desktop Connection" "$@" &
else
[ -n "$1" ] || return 1
@ -359,7 +359,7 @@ fi
# M a c O S X
# ============================================================================ #
if [ -z "$APPLE" ]; then
if ! isMac; then
return
fi

@ -152,7 +152,7 @@ fi
# add newest ruby to path first
ruby_bins="$(find ~/.gem/ruby -maxdepth 2 -name bin -type d 2>/dev/null)"
if [ -n "${APPLE:-}" ]; then
if isMac; then
ruby_bins_newest="$(tail -r <<< "$ruby_bins")"
else
ruby_bins_newest="$(tac <<< "$ruby_bins")"
@ -177,7 +177,7 @@ GOPATH="$github/go-tools"
# /Users/hari/github/go-tools/src/runtime/internal/sys (from $GOPATH)
# shellcheck disable=SC2230
if type -P go &>/dev/null; then
if [ -n "$APPLE" ]; then
if isMac; then
GOROOT="$(dirname "$(dirname "$(greadlink -f "$(which go)")")")"
else
GOROOT="$(dirname "$(dirname "$(readlink -f "$(which go)")")")"
@ -206,7 +206,7 @@ link_latest(){
return 1
fi
[ -e "$path_noversion" ] && [ ! -L "$path_noversion" ] && continue
if [ -n "$APPLE" ]; then
if isMac; then
local ln_opts="-h"
else
local ln_opts="-T"
@ -252,7 +252,7 @@ link_latest(){
#add_PATH "/usr/nagios/libexec"
#add_PATH "/usr/nagios/libexec/contrib"
#if [ -n "$APPLE" ]; then
#if isMac; then
# # MacPort and Octave installation
# add_PATH /opt/local/bin
#
@ -361,7 +361,7 @@ link_latest(){
#export MESOS_HOME=/usr/local/mesos
#add_PATH "$MESOS_HOME/bin"
#if [ -n "$APPLE" ]; then
#if isMac; then
# export MESOS_NATIVE_JAVA_LIBRARY=/usr/local/mesos/src/.libs/libmesos.dylib
#else
# # check this path

@ -47,7 +47,7 @@ isSvn(){
}
svn(){
if [ -n "${APPLE:-}" ]; then
if isMac; then
export stat_formatopt=f
else
export stat_formatopt=c

Loading…
Cancel
Save