Okay, so - BASH kicks ass. I just discovered (thanks to my buddy Aaron) a new keyboard shortcut. I often find myself writing, at times, rather lengthy One-Liners. Sometimes involving if statements and nested loops. Trying to write this out on a single line is very doable, but, sometimes it needs a little better formatting. So - create a script, then run it, and then delete it right? Yes, and bash will do that part for you.
Press: CTRL+X, then CTRL+E - suddenly you will find yourself in the magical world of your favorite editor, in my case, Vim. Write your program - you do not need to place a #!/usr/bin/env bash at the top. Just start writing. Then write, and exit - as soon as the editor program exits, your script is run. Basically what is happening is bash is opening a temporary file (like /tmp/bash-fc-147738968), marking it executable, running it on close of the editor, and then deleting it when done.
Showing posts with label BASH. Show all posts
Showing posts with label BASH. Show all posts
Wednesday, September 2, 2009
Another reason bash kicks ass
Posted by Chuckie at 7:19 AM 0 comments
Labels: BASH, keyboard shortcuts, Vim
Subscribe to:
Posts (Atom)
