Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

When I need to do number one -- add sudo to the previous command -- I just use the up arrow, Ctrl-a to get to the beginning of the line, and add sudo. It's a little slower than the method in the article, but I find it downright dangerous to have something in your command history that means "do whatever was typed previously as root".


It actually won't be in your command history as that. The entry will go into your command history as "sudo previous-line".Try it yourself:

  $ true
  $ echo !!
  echo true
  true
  [up-arrow to see]
  $ echo true


Nice! Consider my objection withdrawn, and my compliments to the developers of bash.


I think in this case, the compliments should go to bill joy, the creator of csh.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: