As Ignacio said, use
!!, but if you insist:
$(history | sed '$d' | sed -n '$p' | cut -d ' ' -f 3-)
$() executes the output of the command inside
sed '$d' deletes the last command, i.e.
2001 $(history | sed '$d' | sed -n '$p' | cut -d ' ' -f 3-)
sed -n '$p' prints only the last line, i.e.
cut -d ' ' -f 3- removes the first three fields, separated by spaces, i.e.
I think it can be made more concise and robust, but it works for now.
Edit: If you want to use
history instead of
!! because the shell you're using doesn't have
!!, you're out of luck;
history is a shell built-in, not a program. And simple shells are not likely to have it if they don't have
!!. For example, dash doesn't:
dash: history: not found