News for hackers. Stuff that matters.
Re:Renaming files with mv without typing the name two times by kesor on Monday April 13, 2020 @09:18PM (#22861894)
In my `set -o vi` bash I can type `v` to edit the command in vim before executing it.
Re:Renaming files with mv without typing the name two times by bnegreve on Monday April 13, 2020 @11:07PM (#22862405)
For the record, you can do this with C-x C-e without vi keybindings
Re:Renaming files with mv without typing the name two times by pknopf on Tuesday April 14, 2020 @01:26AM (#22862990)
The more I read these comments/suggestions, the more I realize I'm bash'ing like a child. I seriously need to embrace my shell a little more.
Re:Renaming files with mv without typing the name two times by rmetzler on Tuesday April 14, 2020 @02:11AM (#22863176)
Same for me. I knew the bash has emacs bindings and I know just enough to go to beginning, end, delete a word, etc. but I never knew you can start emacs with a shortcut like this. How do you even exit emacs properly?
Re:Renaming files with mv without typing the name two times by bnegreve on Tuesday April 14, 2020 @03:43AM (#22863571)
C-x C-s to save, C-x C-c to quit.

But you can also control which editor is going to be used to edit your command line by setting the EDITOR environment variable.

It also works for git, and other commands that need to spawn editors.

Re:Renaming files with mv without typing the name two times by m463 on Tuesday April 14, 2020 @07:55AM (#22864811)
I never knew that existed.

My first thought was "emacs editing characters already work on the command line."

Then I thought, maybe there are commands you want to be really really sure of before submitting them?

Then I realized I very frequently use very long commands with loops and pipes that might benefit, like:

  for i in *.py; do mv $i AA_$i; done
or a little of both:

  find . -type f |while read f; do if cmp -s "$f" ../new/"$f"; then rm -f "$f"; fi ;done
(thanks!)