Re:Show HN: ALL_CAPS => sudo all_caps (Bash)
by timeattack on Monday October 21, 2019 @06:54AM
(#21310827)
Most often case is when you forget to type sudo before command. This implementation propose to re-type executable name in all-caps (or type it in all-caps beforehand).
More efficient approach is to use keybinding like Ctrl+T to prepend sudo to the current command (or to the previous command if current is empty).
Re:Show HN: ALL_CAPS => sudo all_caps (Bash)
by al_form2000 on Monday October 21, 2019 @12:41PM
(#21314311)
As mentioned above, you don't need to retype:
$ foo bar baz<cr>
^P^A<esc>u
$ FOO bar baz<cr>
As for ^T, I'd wholly forgotten about bind, inputrc and all that- but of course both your proposal and the above can be put into an inputrc macro and bound to a key. However the all caps version is shorter when you remember you need sudo in the first place ;).
Re:Show HN: ALL_CAPS => sudo all_caps (Bash)
by weinzierl on Monday October 21, 2019 @12:46PM
(#21314375)
Titles are automatically titlecased when submitted but not when edited. The workaround is to submit and immediately edit afterwards.
Unfortunately many blogs have their titles all uppercase instead of using small caps. For me the use case where I copy an all uppercase title and want it to be titlecased on HN is much more common than the case where I actually want a string of caps. I'm quite ok with the current behavior.
cp /some/tortured/path/to/file.txt /some/other/path/file.txt
chown myuser:myuser !$
https://github.com/nvbn/thefuck
ctrl-a (readline command for beginning of line)
type "sudo"
Also, ctrl-w is really useful. Heck, learning the readline editing keyboard in general is really useful.
More efficient approach is to use keybinding like Ctrl+T to prepend sudo to the current command (or to the previous command if current is empty).
I can't deny that something feels terribly wrong about this sort of script, though.
Unfortunately many blogs have their titles all uppercase instead of using small caps. For me the use case where I copy an all uppercase title and want it to be titlecased on HN is much more common than the case where I actually want a string of caps. I'm quite ok with the current behavior.