Drag and drop text clippings to run Terminal commands

Nov 07, '07 07:30:00AM

Contributed by: dmmorse

This is one I stumbled upon by complete accident: Text clippings can be dragged and dropped into a Terminal window to run a succession of commands.

To run a single command, the text clipping needs to include the command and a trailing carriage return. Multiple commands may be run in succession by separating them with carriage returns, and following the last command with a trailing carriage return.

[robg adds: At first I thought this tip referred to dragging and dropping text from one app to another, which we've covered here quite a few times in the past. However, it's referring (I believe) to the actual text clipping file you get if you, for instance, drag a snippet of text to the desktop. You can then drop that icon into a Terminal window to execute the commands it contains. You can use semicolons to separate commands on one line, and a backslash-carriage return to continue one command on a new line. I tried it with a simple ls -al; top -u 10[CR] that I created in TextEdit, and it worked as described.]

Comments (2)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20071028103326111