5 ms·
Show HN: ALL_CAPS => sudo all_caps (Bash)
- timeattack 7y agoMost 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).
- faeyanpiraat 7y agoor use "sudo !!"
- al_form2000 7y agoAs 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 ;).
- nfriedly 7y agoFYI, in bash, "sudo !!" re-runs the previous command with sudo.
- papln 7y agoThat's not "funny" enough, unless the "!!" is replaced by an emoji.
- blacksmith_tb 7y agoI use it all the time! But also worth remembering that !$ is the object of your last command, so you could do something like cp /some/tortured/path/to/file.txt /some/other/path/file.txt chown myuser:myuser !$
- gitgud 7y agoThanks for that little tip! It's a constant mistype for me... $ apt install something E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
- taejo 7y agoDid some kind of automoderation break the title by changing ALL_CAPS to All_caps?
- al_form2000 7y agoI remember writing the title as ALL_CAPS => sudo all_caps So it appears something did actually change it.
- weinzierl 7y agoTitles 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.
- dang 7y agoweinzierl got it right. We've edited the title back.
- gnulinux 7y agoIsn't typing 'sudo yum' faster than 'YUM'?
- brirec 7y ago…is that a sarcastic question? How would typing 'YUM' NOT be faster than 'sudo yum'? I can't deny that something feels terribly wrong about this sort of script, though.
- gnulinux 7y agobecause you need press shift while pressing y, u, m to type YUM. I definitely type sudo yum faster.
- bradknowles 7y agoDo you not have a CAPSLOCK key?
- teamspirit 7y agoMy caps lock is mapped to ESC.
- anoncake 7y agoMany people map capslock to Ctrl or Escape. Or both, depending on whether the key is held or tappped.
- hackbinary 7y agoup arrow 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.
- apexalpha 7y agosudo !!
- al_form2000 7y ago$ foo bar baz<cr> ^P^A<esc>u $ FOO bar baz<cr> That's three keystrokes less - even for the history (!!) version. :-)
- rudiv 7y agoRemember, all caps when you spell the man name.
- sonofgod 7y agoThis is hideous. Congratulations! :D
- philshem 7y agoReminds me of https://github.com/nvbn/thefuck https://github.com/nvbn/thefuck