Browse Source

use __match

pull/1/head
10sr 11 years ago
parent
commit
a785d5f404
1 changed files with 15 additions and 9 deletions
  1. +15
    -9
      shrc

+ 15
- 9
shrc View File

@@ -3,7 +3,10 @@
# TODO: use tput # TODO: use tput


# If not running interactively, don't do anything # If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias isinteractive=false
expr "$-" : '^.*i' >/dev/null && alias isinteractive=true

isinteractive || return


########################################## ##########################################
null(){ null(){
@@ -13,6 +16,12 @@ __try_exec(){
type $1 >/dev/null 2>&1 && "$@" type $1 >/dev/null 2>&1 && "$@"
} }


__match(){
# __match str1 str2
# return 0 if str2 is found in str1
expr "$1" : ".*$2.*" >/dev/null
}

########################## ##########################
# system type # system type


@@ -46,13 +55,10 @@ fi


################################# #################################


__match(){
# __match str1 str2
# return 0 if str2 is found in str1
expr "$1" : ".*$2.*" >/dev/null
}
alias firstload=false
__match "$PATH" "$HOME/.local/bin" || alias firstload=true


if ! __match "$PATH" "$HOME/.local/bin"
if firstload
then then
if test -d "$HOME/.local/bin" if test -d "$HOME/.local/bin"
then then
@@ -117,8 +123,8 @@ export GIT_EDITOR="$EDITOR"
export GIT_MERGE_AUTOEDIT=no export GIT_MERGE_AUTOEDIT=no


if test -n "$TMUX" && \ if test -n "$TMUX" && \
echo $TERM | grep screen >/dev/null 2>&1 && \
tmux display -p '#{client_termname}' | grep 256color >/dev/null 2>&1
__match $TERM screen && \
__match `tmux display -p '#{client_termname}'` 256color
then then
TERM=screen-256color TERM=screen-256color
fi fi


Loading…
Cancel
Save