소스 검색

now shrc can be invoked as a script

pull/1/head
10sr 11 년 전
부모
커밋
59ba52e2b5
1개의 변경된 파일24개의 추가작업 그리고 9개의 파일을 삭제
  1. +24
    -9
      shrc

+ 24
- 9
shrc 파일 보기

@@ -1,13 +1,7 @@
#!/bin/bash
#!/bin/sh

# TODO: use tput

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

isinteractive || return

##########################################
null(){
"$@" >/dev/null 2>&1
@@ -17,11 +11,16 @@ __try_exec(){
}

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

alias isinteractive=false
__match "$-" i >/dev/null && alias isinteractive=true
alias issourced=true
expr "$0" : "^.*shrc$" >/dev/null && alias issourced=false # invoked as script

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

@@ -55,6 +54,18 @@ fi

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

if inbash
then
shrc="$BASH_SOURCE"
elif inzsh
then
shrc="$0"
fi

dotdir="`dirname "$shrc"`"

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

alias firstload=false
__match "$PATH" "$HOME/.local/bin" || alias firstload=true

@@ -175,6 +186,10 @@ fi

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

# If not running interactively, don't do anything
issourced || exit
isinteractive || return

iswindows && alias tty="echo cmd.exe"
type fortune >/dev/null 2>&1 && {
fortune


불러오는 중...
취소
저장