News for hackers. Stuff that matters.
Re:Renaming files with mv without typing the name two times by Kiro on Tuesday April 14, 2020 @03:00AM (#22863378)
Or I just use this script which is much more intuitive and convenient.
Re:Renaming files with mv without typing the name two times by kazinator on Tuesday April 14, 2020 @03:59AM (#22863642)
In my other post, I got the readline method down to one control code. You type "mv name" and hit the assigned control character, which produces a second copy of the name that you can edit in place. It works with any command: mv, cp, ln, git mv ... The editing is in the same command line, resulting in a proper argument that is in the command line. It gets saved into your history, and can be pasted into a script.
Re:Renaming files with mv without typing the name two times by zeepzeep on Tuesday April 14, 2020 @03:31AM (#22863513)
But only solves one use case. Why not learn how to do it for every other unix tool?
Re:Renaming files with mv without typing the name two times by Kiro on Tuesday April 14, 2020 @05:17AM (#22864025)
I don't see how this script prevents me from learning it. With that said, we're obviously in different ballparks when it comes to the terminal. I don't need to do anything fancy. cd, ls, mv and git are pretty much the only commands I ever use. For me, this script fits nicely into my workflow.
Re:Renaming files with mv without typing the name two times by kelnos on Thursday April 16, 2020 @06:18AM (#22887894)
But it's... not? What if I want to use the same trick with 'cp'? Do I go and copy-paste my script, or maybe spend time to make it generic enough to handle both commands? That's not a good use of my time when the shell will do it for me, if only I'd spend a minute to learn.