Skip to content

Instantly share code, notes, and snippets.

@jtimberman
Forked from stevendanna/gist:a10ac5540743d233d26b
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save jtimberman/6a174fc00c043e3ef1e0 to your computer and use it in GitHub Desktop.

Select an option

Save jtimberman/6a174fc00c043e3ef1e0 to your computer and use it in GitHub Desktop.

Revisions

  1. @stevendanna stevendanna created this gist Dec 4, 2014.
    10 changes: 10 additions & 0 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    save-last-command() {
    last_command=$(fc -nl 0)
    command_name="$1"
    read -r -d '' new_fun <<EOF
    ${command_name}() {
    $last_command
    }
    EOF
    eval "$new_fun"
    }