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
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtimberman/6a174fc00c043e3ef1e0 to your computer and use it in GitHub Desktop.
Save jtimberman/6a174fc00c043e3ef1e0 to your computer and use it in GitHub Desktop.
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"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment