aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-18 22:06:06 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-18 22:29:09 +1200
commita07c186d9c18355f6997aeb8d71d197caafc80e2 (patch)
tree57914722a314980d59a564be184305fe268cb4c1 /bash/bashrc.d
parentDrastically limit amount of history kept (diff)
downloaddotfiles-a07c186d9c18355f6997aeb8d71d197caafc80e2.tar.gz
dotfiles-a07c186d9c18355f6997aeb8d71d197caafc80e2.zip
Add lhn()
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r--bash/bashrc.d/lhn.bash7
1 files changed, 7 insertions, 0 deletions
diff --git a/bash/bashrc.d/lhn.bash b/bash/bashrc.d/lhn.bash
new file mode 100644
index 00000000..89c6f5da
--- /dev/null
+++ b/bash/bashrc.d/lhn.bash
@@ -0,0 +1,7 @@
+# Print the history number of the last command
+lhn () {
+ local last
+ last=$(fc -l -1) || return
+ [[ -n $last ]] || return
+ printf '%u\n' "${last%%[^0-9]*}"
+}