Skip to content

Instantly share code, notes, and snippets.

@Memphizzz
Created September 13, 2017 13:46
Show Gist options
  • Save Memphizzz/efca187083860a21911620e86a13ca5a to your computer and use it in GitHub Desktop.
Save Memphizzz/efca187083860a21911620e86a13ca5a to your computer and use it in GitHub Desktop.
function rs
set PREV_CMD (history | head -1)
echo Running: sudo $PREV_CMD
sudo $PREV_CMD
end
@etu
Copy link

etu commented Sep 13, 2017

This should work:

function rs
  set PREV_CMD $history[1]
  echo Running: sudo $PREV_CMD 
  eval "sudo $PREV_CMD"
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment