News for hackers. Stuff that matters.
Re:Awesome but commonly unknown Linux Commands by footle on Wednesday August 10, 2011 @05:57AM (#2867481)
git "borrowed" this idea too. You can use `git checkout -` to checkout the last thing you checked out; very handy when merging.
Re:Awesome but commonly unknown Linux Commands by nosignal on Wednesday August 10, 2011 @07:45AM (#2867761)
Python sort of did too, you can use _ to access the last-returned variable in the interpreter.

    [testfunc(x) for x in testlist]

    <successful result>

    success = _

    print _

    <successful result>
It's useful when using the interpreter as a calculator, or when you're bashing out some calculation you can never remember how to do properly.
Re:Awesome but commonly unknown Linux Commands by brettnak on Wednesday August 10, 2011 @01:31PM (#2869254)
The same thing also works in irb.

    >> "foo"
    => "foo"
    >> bar = _
    => "foo"
    >> bar
    => "foo"
Re:Awesome but commonly unknown Linux Commands by LiveTheDream on Thursday August 11, 2011 @12:39AM (#2871418)
in bash you can use $_ to access the last argument of the previous command. It lets you do things like this:

    $ pwd
    /home/foo
    $ mkdir -p bar/baz/qux && cd $_
    $ pwd
    /home/foo/bar/baz/qux