Wanted

Spread the love

Wanted: A bash command that undoes the previous bash command. The name of the command shall be “oops.” It will be written in an object oriented programming language.

See the whole “WANTED” list here.

Have you read the breakthrough novel of the year? When you are done with that, try:

In Search of Sungudogo by Greg Laden, now in Kindle or Paperback
*Please note:
Links to books and other items on this page and elsewhere on Greg Ladens' blog may send you to Amazon, where I am a registered affiliate. As an Amazon Associate I earn from qualifying purchases, which helps to fund this site.

Spread the love

19 thoughts on “Wanted

  1. If you were just talking about BASH commands, ie
    $ EXPORT foo=bar
    $ undo

    that might be possible (though I don’t know how useful).

    If you’re talking about
    $ rm-rf*
    $ undo

    than you’re talking about a version controlled file system, and probably RAM too.

    It would be nice but it strikes me as very infeasible.

    Particularly if you want to extend it to.

    $ mail -s “You’re a jerk” boss@mycompany.com
    $ undo

  2. without micro-backup, you can’t do it. (I.e, something like TimeMachine but with way more polling and copying).

    It would be a mark of severe mental illness to think you could handle all the possible implications of every command combination.

    Therefore, the “command” will end up being something like, get timestamp from command-before-last in .history, do a restore from that on any files changed with last command.

    And the micro-backup will do most of the work.

    We all want things, but we don’t all get them.

  3. Also, QED, the requirement for it being an object oriented language is foolish.

    There are well-established folder-walk and backup functions out there, and whether they’re functional, procedural, or object-oriented is pretty much irrelevant, unless you’re willing to swallow the humiliation of having your python script be doing nothing but a bunch of system calls wrapped for no earthly reason in a Potemkin object.

  4. That all said, I think Greg is mainly being whimsical and humorous here. So the above is why I think so.

  5. This reminds me of my possible retirement project to develop a new object oriented programming language to be called Mott.

    Mott the OOPL.

  6. What about a command that removes previously written comments that demonstrate that the person who wrote them has a delay switch on their sense of humor? It could be called “Doh!”

  7. You can do this in Scheme using call-with-current-continuation, but that’s about a googolplex of right brackets you’ll never see again. The programmer will need to be sedated for the rest of his life and who knows what unthinkable hideous unborn things might be drawn by the smell of burning entropy. Messing with causality doesn’t come cheap.

    But not object oriented. I never go meddling with things I might possibly understand.

  8. The general case is impossible. Not just very improbable, but formally impossible. Proof:
    >1$ alias oops=’ls’
    >2$ oops

  9. You could always switch to the Pick OS. Everything is journaled with rewind.

    $ post blog “need bash undo” -v
    $ oops -1
    oops: ERROR: cannot undo reality. Deal with it.

  10. IT’s worse – much worse – than Greg thinks, Ange.

    I believe someone DID write oops …

    all in one take …

    … then immediately tried it out.

  11. QED, the requirement for it being an object oriented language is foolish.

    yeah, oops in an object oriented programming language is foolish

  12. Rob and Ange, it actually made me think of Nethack – from, I think, the same place Python came from. Unlike the other roguelike branch, the *hacks tried to think of every possible combination of the person, taking action Y, sometimes with object X, on object or creature Z. An undo might even be possible there.

  13. Looking at the WANTED list, I think AdBlock for a site you’re trying to help is not good. “curtains” seems reasonable. I’d guess a greasemonkey script would be the easiest way? for all pages in the greasemonkey list,

    e.g.
    scienceblogs.com
    scientopia.org
    blogs.discovermag.com

    You run:

    window.scrollBy(0,50); // Zero Right, 50 down

    Or whatever.

  14. The best solution I can think of is to run everything on a virt and take a snapshot of the virt after every shell command, then oops just restores the previous virt state.

    I am pretty sure it would suck.

  15. Ok, folks, we can do better. Really.

    A well written bash command will return 0 on completion, a different number on an error, will send output to standard output and take date in from standard input. And so on.

    These things do not happen because the pink unicorn declares it so. These things happen becasue a well written bash command includes these things in the code.

    All “oops” has to do is to invoke the opps parameter of the previously called bash command. The oops stack is where well behaved bash commands store pointers to the necessary data to undo a command. Thus, oops can use the stack to undo multiple previous commands. Not all command can be undone, just as in today’s world not all things that can be undone in word processors or file management gui’s and so on can be undone.

    Certain commans, obviously, make no sense to undo. How would one undo an LS.

    sort foo > bar is easy. oops deletes bar. sort foo >> bar is esy. Oops buffer stores a pointer to the last lin in bar before the command. Ooops, then, would delete the contents of the file following the pointer.

    Ooops can be limited to a maximum amount of record keeping except when certain command switches are in place, which would force the command to use the overhead necessary.

Leave a Reply to Greg Laden Cancel reply

Your email address will not be published. Required fields are marked *