2017-07-30 00:04:04 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# POSIX NOTICE
|
|
|
|
# This script is not fully POSIX-compliant. It uses features that,
|
|
|
|
# while popular, are undefined by POSIX. Namely:
|
|
|
|
#
|
|
|
|
# * The use of the `local` keyword
|
|
|
|
#
|
|
|
|
# Users of this script on minimalist shells will have to adapt
|
|
|
|
# this script accordingly.
|
|
|
|
|
|
|
|
contains() {
|
|
|
|
string="$1"
|
|
|
|
substring="$2"
|
|
|
|
if test "${string#*$substring}" != "$string"; then
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Common miscellaneous aliases are all defined here for convenience
|
|
|
|
__define_aliases() {
|
|
|
|
|
|
|
|
# Common Aliases
|
|
|
|
|
|
|
|
alias cp='cp -i'
|
|
|
|
alias dd=dcfldd
|
|
|
|
alias ls='ls --color=auto'
|
|
|
|
alias ll='ls -alF'
|
|
|
|
alias la='ls -a --color=auto'
|
|
|
|
alias l='ls -CF'
|
|
|
|
alias waitwhat='echo $?'
|
|
|
|
|
|
|
|
alias fug='sudo `history -p !!`'
|
|
|
|
}
|
|
|
|
|
|
|
|
# Functions to be exported to the shell
|
|
|
|
# Mostly just helper wrappers and such
|
|
|
|
__define_functions() {
|
|
|
|
# Arch-only helper functions
|
2017-08-09 18:26:56 -05:00
|
|
|
if [ "$(which pacman)" ]; then
|
2017-07-30 00:04:04 -05:00
|
|
|
export PAC_HELPER="pacaur"
|
|
|
|
local helpers="pacaur yaourt pacman"
|
|
|
|
for helper in $helpers; do
|
|
|
|
if [ "$(pacman -Qq "$helper" > /dev/null)" ]; then
|
|
|
|
export PAC_HELPER="$helper"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
alias pac="\$PAC_HELPER"
|
|
|
|
alias pacq="\$PAC_HELPER -Qs"
|
|
|
|
alias pacqi="\$PAC_HELPER -Qi"
|
|
|
|
alias pacs="\$PAC_HELPER -S"
|
|
|
|
alias pacss="\$PAC_HELPER -Ss"
|
|
|
|
alias pacsu="\$PAC_HELPER -Syu"
|
|
|
|
alias pacsyu="\$PAC_HELPER -Syyu"
|
|
|
|
alias pacsr="\$PAC_HELPER -Rsnu"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Call functions that need to be called
|
|
|
|
__define_aliases
|
|
|
|
__define_functions
|
|
|
|
|
|
|
|
export TERM="linux"
|
|
|
|
|
|
|
|
EDITOR=$(which vim)
|
2017-07-30 02:20:29 -05:00
|
|
|
PATH=$PATH:~/.bin:~/.local/bin
|
2017-07-30 00:04:04 -05:00
|
|
|
export EDITOR
|
|
|
|
export PATH
|