Pārlūkot izejas kodu

now shrc can be invoked as a script

pull/1/head
10sr pirms 11 gadiem
vecāks
revīzija
59ba52e2b5
1 mainītis faili ar 24 papildinājumiem un 9 dzēšanām
  1. +24
    -9
      shrc

+ 24
- 9
shrc Parādīt failu

@@ -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


Notiek ielāde…
Atcelt
Saglabāt