Live data from Hacker News

The Fuck – Correct your previous console command

github.com

71–80 of 173 posts

Re: The Fuck – Correct your previous console command

#71

Cool idea. For those systems where you don't have the option of adding a 3rd party tool, it's probably worth knowing some of the standard bash shortcuts. The easy to remember ones are: !^ - the first argument from the previous command !$ - the last argument from the previous command !* - all of the arguments from the previous command !! - the entire previous command For example: $ apt-get install foo # Crap $ sudo !!

Typo correction is useful too.

^foo^bar

git brnch

^r^ra

This works on all Unix machines

Re: The Fuck – Correct your previous console command

#72

Cool idea. For those systems where you don't have the option of adding a 3rd party tool, it's probably worth knowing some of the standard bash shortcuts. The easy to remember ones are: !^ - the first argument from the previous command !$ - the last argument from the previous command !* - all of the arguments from the previous command !! - the entire previous command For example: $ apt-get install foo # Crap $ sudo !!

BTW, all of those commands are from the original BSD c-shell. Bash developers knew a good thing when they saw it.

Re: The Fuck – Correct your previous console command

#73

Issue #1 is classic. Running 'Fuck' twice attempts to evaluate the previous 'Fuck'- and returns 'fsck' - which tries to forcefully check your mounted drive. I wouldn't trust this app for practical use.

You can surely trust that it will 'fuck' stuff up at some point.

Re: The Fuck – Correct your previous console command

#76
post #6
post #4

Not being 100% sure which command this will correct to is dangerous. Also the need for this is largely negated by a shell with autosuggestions.

> Not being 100% sure which command this will correct to is dangerous. And yet the concept of the invocation `fuck --dry-run` is surely unappealing. :-)

I think dry-run should be the default. Then if you really want to run it without checking the command first you could do:

    fuck --without-condom
or maybe

    fuck --iamfeelinglucky

Re: The Fuck – Correct your previous console command

#77
post #30
post #4

Not being 100% sure which command this will correct to is dangerous. Also the need for this is largely negated by a shell with autosuggestions.

I think a good solution to this would be to have it display the command it's going to run with a y/n prompt. It would only add one extra keystroke and make the utility a lot safer. I think I'll make a pull request or fork or something that does this this weekend if somebody hasn't already by then.

If it defaulted to yes, then running it would be,

    fuck
which is probably good enough. (Pressing the same key twice is pretty much the same as pressing one key, but pressing two different keys is harder.)

Re: The Fuck – Correct your previous console command

#79
post #6

Earlier quoted context omitted.

> Not being 100% sure which command this will correct to is dangerous. And yet the concept of the invocation `fuck --dry-run` is surely unappealing. :-)

I think dry-run should be the default. Then if you really want to run it without checking the command first you could do: fuck --without-condom or maybe fuck --iamfeelinglucky

Ok. The --without-condom needs to be an option.
Post reply on HN