mv使用小技巧

mv使用小技巧

𝑨𝒏𝒈𝒂𝒛𝒊𝒘𝒂

Something like this isn't really necessary. I do something like this (bash) all the time when I want to change a part of a filename (renames "foo-bar-baz.txt" to "foo-bar-quux.txt"):

  mv foo-bar-{baz,quux}.txt

You can have an 'empty' bit to add or remove something from the name (renames "foo-bar.txt" to "foo-bar-baz.txt"):

  mv foo-bar{,-baz}.txt

That will work with pathname parts as well (as in the linked demo video) if you include them in the command.

I guess the linked script is useful if you need to do some complex edits to the filename, since you can't usefully have more than one curly-brace-group for this use case. But in that case honestly I'm fine just double-clicking the first argument to select, and then middle-clicking to paste, and then using the arrow keys to edit.


source:https://news.ycombinator.com/item?id=22860140


Report Page