summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2014-08-20 21:30:08 +0200
committerJan Pokorný <jpokorny@redhat.com>2014-08-20 21:30:08 +0200
commit69563254e9eca424760a35fbac80d2df022aba1a (patch)
treee35da725e161d8f0a800a59941a53f18031a8989
parent1904f73daba7e443f23a1adbcafcf716f21cea38 (diff)
downloaddotfiles-69563254e9eca424760a35fbac80d2df022aba1a.tar.gz
dotfiles-69563254e9eca424760a35fbac80d2df022aba1a.tar.xz
dotfiles-69563254e9eca424760a35fbac80d2df022aba1a.zip
Bash config: various stylistic changes
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r--.bashrc35
1 files changed, 14 insertions, 21 deletions
diff --git a/.bashrc b/.bashrc
index b8b469c..8032138 100644
--- a/.bashrc
+++ b/.bashrc
@@ -98,12 +98,12 @@ alias r="fc -s"
alias tree='tree -a'
alias mc='LESS="-RSX" mc'
alias tmux='tmux -2'
-alias acka='$ACK --follow'
-alias ackp='$ACK *.patch --match'
+alias acka='${ACK} --follow'
+alias ackp='${ACK} *.patch --match'
alias fname='find -name'
alias mk='make -j$( \
nproc --ignore=1 2>/dev/null \
- || sed "s|.*\([0-9]\+\)$|\1|" /sys/devices/system/cpu/online; )'
+ || sed "s|.*\([0-9]\+\)$|\1|" /sys/devices/system/cpu/online; )'
alias vimdiff='vimdiff -u NONE'
# internal, debug, etc.
@@ -112,51 +112,44 @@ alias int-usage='echo "usage: $FUNCNAME "'
# dir aliases (use either as "gmy" or "cd $(gmy)" or, e.g., "gmy dotfiles")
diralias ~/wrkspc
-diralias ~/wrkspc/gmy
-diralias ~/wrkspc/gwork
+for d in $(ls -1d ~/wrkspc/*/); do diralias "${d}"; done
# internal, debug, etc.
-debug-argsep () {
- while [ $# -ne 0 ]; do
- echo $1;
- shift
- done
-}
+debug-argsep() { while [ $# -ne 0 ]; do echo $1; shift; done; }
# proper functions
-cdup () {
+cdup() {
local up="."
for i in $(seq 1 $1); do up+="/.."; done
cd "${up}" 2>/dev/null && pwd || :
unset up
}
-cdmk () {
- cd "$1" 2>/dev/null || { mkdir "$1"; cd "$1";}
-}
+cdmk() { cd "$1" 2>/dev/null || { mkdir "$1"; cd "$1";}; }
# Jim Meyring's take on "display the programs with W and X memory"
# http://lists.fedoraproject.org/pipermail/devel/2013-April/181747.html
-sec-wx-mem () {
+sec-wx-mem() {
grep -lE '^[0-9a-f-]+ .wx' /proc/*/maps 2>/dev/null \
| perl -ne 'm!^(/proc/(\d+))/.*! and printf qq(%5d %s\n), $2, `cat $1/cmdline`' \
| tr '\0' ' '
}
-ack-intersection () {
+ack-intersection() {
[ $# -ne 2 ] && int-usage "1st-regexp" "2nd-regexp" && return
- comm <($ACK -l --follow "$1" | sort) <($ACK -l --follow "$2" | sort) -12
+ comm <(${ACK} -l --follow "$1" | sort) \
+ <(${ACK} -l --follow "$2" | sort) -12
}
-hist-grep () {
+hist-grep() {
hist-del-last # omit hist-grep invocation
grep $* -- ~/.bash_history
}
-img-diff () {
+img-diff() {
[ $# -ne 2 ] && int-usage "1st-img" "2nd-img" && return
#xloadimage <(gm compare "$1" "$2" -highlight-color red -highlight-style threshold -file -)
#xloadimage <(compare "$1" "$2" -highlight-color violet -lowlight-color darkgray -compose threshold -)
@@ -165,7 +158,7 @@ img-diff () {
xloadimage <(compare "$1" "$2" -highlight-color violet -lowlight-color darkgray -compose threshold -)
}
-img-qr () {
+img-qr() {
local title="Piped: "
[ $# -ge 1 ] \
&& { input="$1"; title="$1"; } \