|
@@ -1,7 +1,6 @@ |
|
|
#!/bin/bash |
|
|
#!/bin/bash |
|
|
# 外部ファイルの読み込み |
|
|
|
|
|
# test -r ~/filepath && . ~/filepath |
|
|
|
|
|
# ln SRC DST |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test -r /etc/bashrc && . /etc/bashrc |
|
|
|
|
|
|
|
|
########################## |
|
|
########################## |
|
|
# system type |
|
|
# system type |
|
@@ -31,15 +30,16 @@ else |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
########################################## |
|
|
########################################## |
|
|
|
|
|
null(){ |
|
|
|
|
|
"$@" >/dev/null 2>&1 |
|
|
|
|
|
} |
|
|
safe-cmd(){ |
|
|
safe-cmd(){ |
|
|
type $1 >/dev/null 2>&1 && "$@" |
|
|
type $1 >/dev/null 2>&1 && "$@" |
|
|
} |
|
|
} |
|
|
replace-cmd(){ |
|
|
replace-cmd(){ |
|
|
type $1 1>/dev/null || alias $1=: |
|
|
|
|
|
|
|
|
type $1 1>/dev/null || alias $1=true |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
test -r /etc/bashrc && . /etc/bashrc |
|
|
|
|
|
|
|
|
|
|
|
export PS1="\$(__my_prompt_function)\$ " |
|
|
export PS1="\$(__my_prompt_function)\$ " |
|
|
# PROMPT_COMMAND=prompt_function |
|
|
# PROMPT_COMMAND=prompt_function |
|
|
if iswindows |
|
|
if iswindows |
|
@@ -85,11 +85,14 @@ alias q=exit |
|
|
alias p="$PAGER" |
|
|
alias p="$PAGER" |
|
|
alias c=cat |
|
|
alias c=cat |
|
|
alias pcalc="python -i -c 'from math import *' " |
|
|
alias pcalc="python -i -c 'from math import *' " |
|
|
alias _myreloadrc="test -f ~/.bashrc && source ~/.bashrc" |
|
|
|
|
|
|
|
|
alias reloadrc="test -f ~/.bashrc && source ~/.bashrc" |
|
|
alias sudo="sudo " # use aliases through sudo |
|
|
alias sudo="sudo " # use aliases through sudo |
|
|
|
|
|
alias mytime="date +%Y%m%d-%H%M%S" |
|
|
if isdarwin |
|
|
if isdarwin |
|
|
then alias upgrade="port selfupdate && port sync && port upgrade installed" |
|
|
|
|
|
else alias upgrade="sudo apt-get autoremove --yes && sudo apt-get update --yes && sudo apt-get upgrade --yes" |
|
|
|
|
|
|
|
|
then |
|
|
|
|
|
alias upgrade="port selfupdate && port sync && port upgrade installed" |
|
|
|
|
|
else |
|
|
|
|
|
alias upgrade="sudo apt-get autoremove --yes && sudo apt-get update --yes && sudo apt-get upgrade --yes" |
|
|
fi |
|
|
fi |
|
|
# alias diff="$(type colordiff >/dev/null 2>&1 && test $TERM != dumb && echo color)diff -u" |
|
|
# alias diff="$(type colordiff >/dev/null 2>&1 && test $TERM != dumb && echo color)diff -u" |
|
|
# type trash >/dev/null 2>&1 && alias rm=trash |
|
|
# type trash >/dev/null 2>&1 && alias rm=trash |
|
@@ -216,7 +219,7 @@ convmv-sjis2utf8-test(){ |
|
|
convmv-sjis2utf8-notest(){ |
|
|
convmv-sjis2utf8-notest(){ |
|
|
convmv -r -f sjis -t utf8 * --notest |
|
|
convmv -r -f sjis -t utf8 * --notest |
|
|
} |
|
|
} |
|
|
dl-my-init-files(){ |
|
|
|
|
|
|
|
|
_my-dl-init-files(){ |
|
|
for file in .bashrc .vimrc .emacs |
|
|
for file in .bashrc .vimrc .emacs |
|
|
do |
|
|
do |
|
|
local flag=0 |
|
|
local flag=0 |
|
@@ -259,7 +262,7 @@ _mygitconfig(){ |
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if type _git >/dev/null 2>&1 # enable programmable completion when alias g=git |
|
|
|
|
|
|
|
|
if type _git >/dev/null 2>&1 # enable programmable completion of g |
|
|
then |
|
|
then |
|
|
complete -o bashdefault -o default -o nospace -F _git g 2>/dev/null \ |
|
|
complete -o bashdefault -o default -o nospace -F _git g 2>/dev/null \ |
|
|
|| complete -o default -o nospace -F _git g |
|
|
|| complete -o default -o nospace -F _git g |
|
@@ -277,10 +280,6 @@ __my_svn_ps1(){ |
|
|
test -n "${svn_branch}" && printf "$1" "{$svn_branch}" |
|
|
test -n "${svn_branch}" && printf "$1" "{$svn_branch}" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
replace-cmd date |
|
|
|
|
|
replace-cmd __my_svn_ps1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__my_prompt_function(){ # used by PS1 |
|
|
__my_prompt_function(){ # used by PS1 |
|
|
local lastreturn=$? |
|
|
local lastreturn=$? |
|
|
if test "${TERM}" == dumb |
|
|
if test "${TERM}" == dumb |
|
|