summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-06-09 18:30:23 +0200
committerAnton Khirnov <anton@khirnov.net>2021-06-09 18:30:23 +0200
commitd52f002785c1a7c1528dc94f06812dc433f7a784 (patch)
tree92a8f53ff5ee94ebd988143772d1282023f6b85c
parent971c2a07ca4ddc45ab96103a654b98747c5275c0 (diff)
Add shortcuts for head/tail.
-rw-r--r--bash/bashrc17
1 files changed, 17 insertions, 0 deletions
diff --git a/bash/bashrc b/bash/bashrc
index 2947bf0..09d6a95 100644
--- a/bash/bashrc
+++ b/bash/bashrc
@@ -55,6 +55,23 @@ cu()
cd "${dir}"
}
+# head/tail shortcut
+# e.g. "lt|h" or "h lt"
+__ht()
+{
+ local cmd=$1
+ shift
+
+ if [ $# -ne 0 ]; then
+ $@ | $cmd
+ else
+ $cmd
+ fi
+}
+
+h() { __ht "head -32" $@; }
+t() { __ht "tail -32" $@; }
+
# define the prompt
. ~/.config/bash/prompt
PS1=$(__prompt_func)