summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2014-03-11 13:40:54 +0100
committerJan Pokorný <jpokorny@redhat.com>2014-03-11 13:42:50 +0100
commit3b6dcb0b3a6bed2769a2e57bc1bb46558b888b40 (patch)
tree5e365100dd2fa6b242598b007e2fc29437c1d9d4
parent59a98093d0dd456ef84fce214fd79ecd15d25d63 (diff)
downloaddotfiles-3b6dcb0b3a6bed2769a2e57bc1bb46558b888b40.tar.gz
dotfiles-3b6dcb0b3a6bed2769a2e57bc1bb46558b888b40.tar.xz
dotfiles-3b6dcb0b3a6bed2769a2e57bc1bb46558b888b40.zip
Bash config: finally solve the ack cross-version incompatibility
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r--.bashrc8
1 files changed, 6 insertions, 2 deletions
diff --git a/.bashrc b/.bashrc
index 429b840..4d06f24 100644
--- a/.bashrc
+++ b/.bashrc
@@ -50,6 +50,10 @@ HISTCONTROL=ignoreboth
PROMPT_COMMAND='(history -a)'
PS1='\[\033[01;34m\]\u@\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\$ '
+ACK=ack
+test "$(ack --version | head -n1 | sed 's|^ack\s\([0-9]\+\).*|\1|')" -ge 2 \
+ || ACK+=" -a"
+
# http://ruslanspivak.com/2010/11/25/bash-history-incremental-search-forward/
stty stop ^X
@@ -57,7 +61,7 @@ stty stop ^X
alias tree='tree -a'
alias mc='LESS="-RSX" mc'
alias tmux='tmux -2'
-alias acka='ack -a --follow'
+alias acka='$ACK --follow'
# internal, debug, etc.
alias hist-del-last='history -d $(history 1 | cut -d" " -f2)' # historical NOOP
@@ -101,7 +105,7 @@ sec-wx-mem () {
ack-intersection () {
[ $# -ne 2 ] && int-usage "1st-regexp" "2nd-regexp" && return
- comm <(ack -al --follow "$1" | sort) <(ack -al --follow "$2" | sort) -12
+ comm <($ACK -l --follow "$1" | sort) <($ACK -l --follow "$2" | sort) -12
}
hist-grep () {