I spend copious amounts of time on the servers at 8tracks.com. On occasion, I upload a ruby/base/etc script to the server to test. In the past I normally fire up
vi on the server, paste the code in, save it, and execute it. When the script fails because of a bug, I fix the file on my local editor, copy the code, reopen the file on the server with vi, save it, and execute it. This is slow. Here’s a faster way using
cat and the
CTRL+d keyboard shortcut in a terminal.
$ cat < my_new_file Hello, world! <hit CTRL+d here> $ cat my_new_file Hello, world!
vi from the equation. This works for my previous tip about executing arbitrary ruby code on the shell.