News for hackers. Stuff that matters.
Re:Show HN: ALL_CAPS => sudo all_caps (Bash) by nfriedly on Monday October 21, 2019 @09:33AM (#21312039)
FYI, in bash, "sudo !!" re-runs the previous command with sudo.
Re:Show HN: ALL_CAPS => sudo all_caps (Bash) by papln on Monday October 21, 2019 @11:43AM (#21313557)
That's not "funny" enough, unless the "!!" is replaced by an emoji.
Re:Show HN: ALL_CAPS => sudo all_caps (Bash) by anoncake on Tuesday October 22, 2019 @04:32AM (#21321401)

    papln used multiple exclamation marks and is clearly insane. This incident will be reported.
Re:Show HN: ALL_CAPS => sudo all_caps (Bash) by toyg on Monday October 21, 2019 @11:56AM (#21313725)
alias goddammit=sudo !!
Re:Show HN: ALL_CAPS => sudo all_caps (Bash) by blacksmith_tb on Monday October 21, 2019 @07:27PM (#21318720)
I 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 !$

Re:Show HN: ALL_CAPS => sudo all_caps (Bash) by gitgud on Tuesday October 22, 2019 @01:24AM (#21320587)
Thanks 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?
Re:Show HN: ALL_CAPS => sudo all_caps (Bash) by philshem on Monday October 21, 2019 @03:00PM (#21315925)
Re:Show HN: ALL_CAPS => sudo all_caps (Bash) by hackbinary on Monday October 21, 2019 @10:36AM (#21312729)
up 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.

Re:Show HN: ALL_CAPS => sudo all_caps (Bash) by al_form2000 on Monday October 21, 2019 @12:20PM (#21314070)

        $ foo bar baz<cr>
        ^P^A<esc>u
        $ FOO bar baz<cr>
That's three keystrokes less - even for the history (!!) version. :-)
Re:Show HN: ALL_CAPS =&gt; sudo all_caps (Bash) by apexalpha on Monday October 21, 2019 @10:43AM (#21312803)
sudo !!
Re:Show HN: ALL_CAPS =&gt; sudo all_caps (Bash) by rudiv on Monday October 21, 2019 @11:28AM (#21313380)
Remember, all caps when you spell the man name.
Re:Show HN: ALL_CAPS =&gt; 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 =&gt; 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 =&gt; sudo all_caps (Bash) by faeyanpiraat on Monday October 21, 2019 @10:32AM (#21312691)
or use "sudo !!"
Re:Show HN: ALL_CAPS =&gt; sudo all_caps (Bash) by sonofgod on Monday October 21, 2019 @11:53AM (#21313671)
This is hideous. Congratulations! :D
Re:Show HN: ALL_CAPS =&gt; sudo all_caps (Bash) by gnulinux on Monday October 21, 2019 @10:29AM (#21312649)
Isn't typing 'sudo yum' faster than 'YUM'?
Re:Show HN: ALL_CAPS =&gt; sudo all_caps (Bash) by brirec on Monday October 21, 2019 @12:51PM (#21314430)
…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.

Re:Show HN: ALL_CAPS =&gt; sudo all_caps (Bash) by gnulinux on Monday October 21, 2019 @01:32PM (#21314912)
because you need press shift while pressing y, u, m to type YUM. I definitely type sudo yum faster.
Re:Show HN: ALL_CAPS =&gt; sudo all_caps (Bash) by bradknowles on Monday October 21, 2019 @01:59PM (#21315242)
Do you not have a CAPSLOCK key?
Re:Show HN: ALL_CAPS =&gt; sudo all_caps (Bash) by anoncake on Tuesday October 22, 2019 @04:34AM (#21321413)
Many people map capslock to Ctrl or Escape. Or both, depending on whether the key is held or tappped.
Re:Show HN: ALL_CAPS =&gt; sudo all_caps (Bash) by teamspirit on Monday October 21, 2019 @07:20PM (#21318670)
My caps lock is mapped to ESC.
Re:Show HN: ALL_CAPS =&gt; sudo all_caps (Bash) by taejo on Monday October 21, 2019 @09:53AM (#21312229)
Did some kind of automoderation break the title by changing ALL_CAPS to All_caps?
Re:Show HN: ALL_CAPS =&gt; sudo all_caps (Bash) by al_form2000 on Monday October 21, 2019 @12:43PM (#21314339)
I remember writing the title as

    ALL_CAPS => sudo all_caps
So it appears something did actually change it.
Re:Show HN: ALL_CAPS =&gt; 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.

Re:Show HN: ALL_CAPS =&gt; sudo all_caps (Bash) by dang on Monday October 21, 2019 @03:37PM (#21316336)
weinzierl got it right. We've edited the title back.