| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- PATH="$HOME/usr/local/bin:$HOME/bin:$HOME/usr/bin:$PATH"
- export PATH
- export LC_ALL=en_US.UTF-8
- if [[ -z "$BASEPATH" ]]; then
- export BASEPATH="$PATH"
- fi
- alias reset-path="export PATH=\"$BASEPATH\""
- detach() {
- for i; do [ -L "$i" ] && cp --remove-destination $(readlink "$i") "$i"; done
- }
- link-tools() {
- PATH=$HOME/tools/bin:$HOME/tools/usr/bin:$PATH
- LD_LIBRARY_PATH=$HOME/tools/lib:$HOME/tools/usr/lib:$LD_LIBRARY_PATH
- export PATH
- export LD_LIBRARY_PATH
- }
- unlink-tools() {
- PATH=$(echo $PATH | perl -pne "s/(?<=:)$HOME/tools.*://g")
- LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | perl -pne "s/(?<=:)$HOME/tools.*://g")
- export PATH
- export LD_LIBRARY_PATH
- }
- alias listall="list -A"
- alias git-graph="git log --graph --pretty=oneline --abbrev-commit --decorate --all"
- alias disk-usage="ls -A | xargs du -shc | sort -h"
- alias reload="source ~/.bashrc"
- alias crontab="VIM_CRONTAB=true crontab"
- refreshterm() {
- clear
- uname -a
- cat /etc/motd
- echo ""
- pwd
- list
- }
- _mkcd_fun() {
- if [ ! -d "$2" ]; then
- if [ -e "$2" ]; then
- echo "mkcd: file exists and is not a directory"
- exit
- else
- $1 "$2"
- fi
- fi
- cd "$2"
- }
- alias mkcd="_mkcd_fun mkdir"
- mkdirs() {
- mkdir -p "$1"
- }
- alias mkcds="_mkcd_fun mkdirs"
- alias diffr="diff --ignore-blank-lines --minimal --side-by-side --report-identical-files --suppress-common-lines"
- alias diffl="diff --changed-group-format='%<' --unchanged-group-format=''"
- _recall_fun() {
- if [ -z "$1" ]; then echo "recall: usage: recall string"; return 1; fi
- history | cut -c 8- | grep --extended-regexp "$1" | \
- grep --invert-match --extended-regexp "^(history|recall|redo)" | sort | uniq
- }
- redo() {
- IFS=$'\n'
- hist=($(_recall_fun $1))
- for ((i=0; i<${#hist[@]}; i++));
- do
- echo "[$i] ${hist[$i]}"
- done
- printf "Index: "
- read idx
- if [[ $idx =~ ^[0-9]+$ ]];
- then
- eval "${hist[$idx]}"
- fi
- unset IFS
- }
- recall(){
- _recall_fun $1 | sed 's/^/ /'
- }
- clear() {
- /usr/bin/clear
- if [[ ! -z "${TMUX}" ]]; then tmux clear-history; fi
- }
- swap() {
- if [[ $# -ne 2 ]]; then
- echo "swap file1 file2" >&2
- return 1
- fi
- local tmpfile=$(mktemp)
- mv "${1}" "${tmpfile}"
- mv "${2}" "${1}"
- mv "${tmpfile}" "${2}"
- }
- alias coms="${HOME}/tools/comstore/commands.sh"
- if [[ $(uname) == "Darwin" ]]; then # OSX / FreeBSD
- . ${HOME}/.profile-bsd
- else
- . ${HOME}/.profile-linux
- fi
- source ${HOME}/.profile-p4
|