Skip to content

Instantly share code, notes, and snippets.

@stevendanna
Created December 4, 2014 14:42
Show Gist options
  • Save stevendanna/a10ac5540743d233d26b to your computer and use it in GitHub Desktop.
Save stevendanna/a10ac5540743d233d26b 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