Clean up .bash* and add some new aliases.
This commit is contained in:
parent
626fb43ec5
commit
2880b02fcf
2 changed files with 25 additions and 35 deletions
32
.bashrc
32
.bashrc
|
|
@ -50,8 +50,8 @@ unset COLOUR
|
|||
|
||||
# Set the debugger prompt.
|
||||
# PS4="+(\\\$? = \$?) \${BASH_SOURCE##*/}\${FUNCNAME:+(\$FUNCNAME)}:\$LINENO: "
|
||||
# PS4="+(\[\e[33m\]\\\$? = \$?\[$(tput sgr0)\]) \[$(tput bold)$(tput setaf 4)\]\${BASH_SOURCE##*/}\[$(tput sgr0)\]\${FUNCNAME:+(\[$(tput bold)$(tput setaf 2)\]\$FUNCNAME\[$(tput sgr0)\])}:\[$(tput bold)$(tput setaf 1)\]\$LINENO\[$(tput sgr0)\]: "
|
||||
export PS4="+(\[\e[33m\]\$?\[$(tput sgr0)\]) \[$(tput bold)$(tput setaf 4)\]\${BASH_SOURCE##*/}\[$(tput sgr0)\]\${FUNCNAME:+(\[$(tput bold)$(tput setaf 2)\]\$FUNCNAME\[$(tput sgr0)\])}:\[$(tput bold)$(tput setaf 1)\]\$LINENO\[$(tput sgr0)\]: "
|
||||
# PS4="+(\[\e[1;33;40m\]\\\$? = \$?\[$(tput sgr0)\]) \[$(tput bold)$(tput setaf 4)\]\${BASH_SOURCE##*/}\[$(tput sgr0)\]\${FUNCNAME:+(\[$(tput bold)$(tput setaf 2)\]\$FUNCNAME\[$(tput sgr0)\])}:\[$(tput bold)$(tput setaf 1)\]\$LINENO\[$(tput sgr0)\]: "
|
||||
export PS4="+(\[\e[1;33;40m\]\$?\[$(tput sgr0)\]) \[$(tput bold)$(tput setaf 4)\]\${BASH_SOURCE##*/}\[$(tput sgr0)\]\${FUNCNAME:+(\[$(tput bold)$(tput setaf 2)\]\$FUNCNAME\[$(tput sgr0)\])}:\[$(tput bold)$(tput setaf 1)\]\$LINENO\[$(tput sgr0)\]: "
|
||||
|
||||
# The commands to execute before the prompt is displayed.
|
||||
# PROMPT_COMMAND=""
|
||||
|
|
@ -59,21 +59,22 @@ export PS4="+(\[\e[33m\]\$?\[$(tput sgr0)\]) \[$(tput bold)$(tput setaf 4)\]\${B
|
|||
# Platform specific set up.
|
||||
PLATFORM="$(uname -s)"
|
||||
if [[ "$PLATFORM" = "Linux" ]]; then
|
||||
# Linux specific functions.
|
||||
psgrep() {
|
||||
[[ -z "$1" ]] && { printf "%s: %s\\n" "Usage" "$FUNCNAME <something>" >&2; return 1; }
|
||||
ps -auwwx | command grep -E --color=always -- "(.*RSS.*|$1)" | grep -F -v "(.*RSS.*|"
|
||||
}
|
||||
|
||||
# Linux specific aliases.
|
||||
hash ftpwho >/dev/null 2>&1 && alias ftpwho='ftpwho -v'
|
||||
hash iftop >/dev/null 2>&1 && alias iftop='TERM=vt100 iftop'
|
||||
hash last less >/dev/null 2>&1 && alias laston='last -a | less'
|
||||
hash ls >/dev/null 2>&1 && alias ls='ls -bFv --color=auto'
|
||||
hash minicom >/dev/null 2>&1 && alias minicom='minicom -m -c on'
|
||||
hash mkpasswd >/dev/null 2>&1 && alias mkpasswd='mkpasswd -m sha512crypt'
|
||||
hash mkpasswd >/dev/null 2>&1 && alias pwgen='mkpasswd -m sha512crypt'
|
||||
#hash pine >/dev/null 2>&1 && alias pine='pine -p "{mail.opensourcerers.net/Service=IMAP/User=darren@afterdark.org.uk/TLS/NoValidate-Cert/NoRsh}.pinerc"'
|
||||
hash pinfo >/dev/null 2>&1 && alias info='pinfo'
|
||||
hash ping >/dev/null 2>&1 && alias ping='ping -b'
|
||||
|
||||
# Linux specific functions.
|
||||
psgrep() {
|
||||
ps -auwwx | command egrep --color=always -- "(.*RSS.*|$1)" | fgrep -v "(.*RSS.*|"
|
||||
}
|
||||
elif [[ "$PLATFORM" = "Darwin" ]]; then
|
||||
# Darwin specific aliases.
|
||||
hash df >/dev/null 2>&1 && alias df='df -P'
|
||||
|
|
@ -84,13 +85,18 @@ else
|
|||
fi
|
||||
unset PLATFORM
|
||||
|
||||
# Common functions.
|
||||
imagebin() {
|
||||
[[ -z "$1" ]] && { printf "%s: %s\\n" "Usage" "$FUNCNAME <filename>" >&2; return 1; }
|
||||
curl -F file="@${1:-}" https://imagebin.ca/upload.php | grep ^url: | cut -d: -f2-
|
||||
}
|
||||
|
||||
# Common aliases.
|
||||
hash bc >/dev/null 2>&1 && alias bc='bc -lq'
|
||||
#hash curl >/dev/null 2>&1 && alias pastebin="curl -F 'sprunge=<-' http://sprunge.us"
|
||||
hash curl >/dev/null 2>&1 && imagebin() { curl -F file="@${1:-}" https://imagebin.ca/upload.php | grep ^url: | cut -d: -f2-; }
|
||||
hash diff >/dev/null 2>&1 && alias diff='diff -u'
|
||||
hash egrep >/dev/null 2>&1 && alias egrep='egrep --color=auto'
|
||||
hash fgrep >/dev/null 2>&1 && alias fgrep='fgrep --color=auto'
|
||||
hash diff >/dev/null 2>&1 && alias diff='diff --color=auto -u'
|
||||
hash grep >/dev/null 2>&1 && alias egrep='grep -E --color=auto'
|
||||
hash grep >/dev/null 2>&1 && alias fgrep='grep -E --color=auto'
|
||||
hash grep >/dev/null 2>&1 && alias grep='grep --color=auto'
|
||||
hash nc >/dev/null 2>&1 && alias pastebin='nc termbin.com 9999'
|
||||
hash screen >/dev/null 2>&1 && alias screen='screen -Ua'
|
||||
hash shellcheck >/dev/null 2>&1 && alias shellcheck='shellcheck -x'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue