Re:Show HN: Redo – Command line utility for quickly creating...
by westurner on Friday April 01, 2022 @02:21PM
(#30881561)
From https://westurner.github.io/hnlog/#comment-20671184 ::
> I log shell commands with a script called usrlog.sh that creates [per-]$USER and per-virtualenv tab-delimited [$_USRLOG] logfiles with unique per-terminal-session identifiers [$_TERM_ID] and ISO8601 timestamps; so it's really easy to just grep for the apt/yum/dnf commands that I ran ad-hoc when I should've just taken a second to create an Ansible role with `ansible-galaxy init ansible-role-name ` and referenced that in a consolidated system playbook with a `when` clause. https://westurner.github.io/dotfiles/usrlog.html#usrlog
stid \#tutorial; echo "$_TERM_ID"
tail -n11 $_USRLOG
ut -n11
grep "$_TERM_ID" "$_USRLOG"
usrlog_grep "$_TERM_ID"
ug "$_TERM_ID"
usrlog_grep_parse "$_TERM_ID"
ugp "$_TERM_ID" # `type ugp`
usrlog.sh: https://github.com/westurner/dotfiles/blob/master/scripts/us...
Re:Show HN: Redo – Command line utility for quickly creating...
by silentprog on Friday April 01, 2022 @12:44PM
(#30880270)
Interesting way of aliasing right from where you use it! I actually replaced my default shell history search with fuzzy search using (https://github.com/junegunn/fzf), I can highly recommend it!
Re:Show HN: Redo – Command line utility for quickly creating...
by buu700 on Friday April 01, 2022 @12:50PM
(#30880356)
Huh, apparently I've already starred that. It must have been posted on HN at some point.
Re:Show HN: Redo – Command line utility for quickly creating...
by cyberge99 on Friday April 01, 2022 @01:24PM
(#30880781)
Interesting, I think there’s a shopt that I’m missing. When I append a comment, it’s not recorded in bash history, as I’d expect.
For commands I use frequently or that are clunky to maintain as one-liners, I'll convert them into functions in my bashrc.
This seems like the best of both worlds in many ways, or at least is a great third option to have.