Advertisement
crossroads1112

repeat

Jun 27th, 2014
773
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.64 KB | None | 0 0
  1. # Add this to your ~/.config/fish/config.fish
  2. # Syntax:
  3. # To just rerun your last command, simply type 'repeat'
  4. # 'repeat sudo' will prepend sudo to your most recent command
  5. # Running repeat with anything other than sudo will append the argument to your most recent command
  6. # To add another command to prepend list remove the # on line 10 and put the command in the quotes. Repeat as needed
  7. function repeat;
  8.   set var (history | head -n 1)
  9.   if test $argv
  10.     if test $argv = "sudo"        #; or "any other command you want to prepend"
  11.         eval $argv $var
  12.     else
  13.         eval $var $argv
  14.     end
  15.     else
  16.         eval $var
  17.   end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement