News for hackers. Stuff that matters.
Re:Show HN: Interactive systemd (a better way to work with s... by kjellsbells on Saturday January 18, 2025 @05:33PM (#42751961)
I agree, but here's a handy Bashism:

^art^op

Converts the "start" in "foo start bar" to "stop", ie runs "foo stop bar". Append :p to do the substitution but print the command instead of running it.

Re:Show HN: Interactive systemd (a better way to work with s... by IgorPartola on Saturday January 18, 2025 @07:36PM (#42752628)
Learn something new every day. What is the ^ representing in this case?
Re:Show HN: Interactive systemd (a better way to work with s... by kjellsbells on Saturday January 18, 2025 @09:46PM (#42753168)
Caret is a word designator in bash's history scheme. Here it acts as a way to mark the thing with the thing being replaced. There's a more detailed explanation in [1] and a quick read in [2]. Essentially bash let's you do manipulation and re-execution of commands from your history and one of the manipulations is via word substitution.

[1] https://www.gnu.org/software/bash/manual/html_node/Word-Desi...

[2] https://www.johndcook.com/blog/2022/10/21/shell-replace-word...