3 ms·
My trick has always been to rely on tab auto-completion. mv foo-<tab> mv foo-bar-baz foo-<tab> mv foo-bar-baz foo-bar-baz Now I can edit the secon
by lopsidedBrain 6y ago
My trick has always been to rely on tab auto-completion.
mv foo-<tab>
mv foo-bar-baz foo-<tab>
mv foo-bar-baz foo-bar-baz
Now I can edit the second part pretty quickly.
Downside: you have to at least type `foo-` twice.
Upside: command line history still has the full command.
- premek 6y agoI do this too, but sometimes its just too many tabs
- figomore 6y agoIn ZSH I do: mv foo-bar <alt>-m It’ll repeat foo-bar. It’s very useful. I miss it when I’m using Fish or Bash.
- grifball 6y agoIn bash, you can do ctrl-w ctrl-y ctrl-y to cut paste paste as long as it doesnt have spaces
- loeg 6y agoTab-completion is somewhat obnoxious in directories with lots of files sharing a common prefix, for example. Also, if you accidentally tab-complete the same file for output and input, depending on how clever the program is, you may end up deleting the source file.
- em-bee 6y agoi always run mv -i to make sure i don't accidentally overwrite an existing file. i don't alias mv to mv -i either, to avoid getting used to the idea that just mv is going to ask me, because i might work on a server where the alias is not set.
- loeg 6y agoI double check the filenames instead, because many of the tools I work with don't have -i flags.
- saagarjha 6y agoI’ve done gcc foo.c -o foo.c far too many times :(
- loeg 6y agoSeems like gcc should be smart enough to reject that mistake nowadays, right?!
- saagarjha 6y agoI should write a shell frontend to gcc to warn if I do this…
- lopsidedBrain 6y agoI work in exactly two modes of `gcc` usage. I either accept `./a.out` as the name I deserve, or I write a `CMakeLists.txt`. There nothing in between.
- deleted 6y ago[deleted]