News for hackers. Stuff that matters.
Re:Ask HN: Small scripts, hacks and automations you're proud... by jes5199 on Monday March 13, 2023 @12:12AM (#35130953)
my favorite is a little command line helper called “o”. it’s a helper for copy and rename commands. If I want to edit a misspelled filename I can just type

o mv mispelled.txt

and it will make an interactive prompt that looks like:

mv mispelled.txt mispelled.txt_

but the last word is editable, so I can use the arrow keys to alter it in place

https://github.com/jes5199/o

Re:Ask HN: Small scripts, hacks and automations you're proud... by ricket on Monday March 13, 2023 @03:16AM (#35132228)
btw there is a bash feature that you can use for this

touch a_tset_file.txt mv a_t{se,es}t_file.txt

it works for changing file extensions:

touch foo.txt mv foo.{txt,json}

or for adding or removing characters, just leave the other side of the comma empty

touch foo.txt mv foo{,bar}.txt mv foo{bar,}.txt

Re:Ask HN: Small scripts, hacks and automations you're proud... by alexthehurst on Monday March 13, 2023 @03:56AM (#35132487)
This is a really clever use of glob expansion.