From a07c186d9c18355f6997aeb8d71d197caafc80e2 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 18 Aug 2016 22:06:06 +1200 Subject: Add lhn() --- bash/bashrc.d/lhn.bash | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 bash/bashrc.d/lhn.bash (limited to 'bash/bashrc.d') 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]*}" +} -- cgit v1.2.3