Redirect Terminal command output to desktop file

Jul 25, '02 08:46:26AM

Contributed by: snit

I added the following to my .login (actually a file called .aliai which is sourced from my .login):

  alias "DT" "cat >> ~/Desktop/DT.txt" 
I can now have any command's output redirected to a file on my desktop called DT.TXT, appending any new text to the end of the file. If I do not want it to append to an old DT.txt that may already exist, I use the DTo command defined by the following alias:
  alias "DTo" "cat > ~/Desktop/DT.txt" 
Either can be used as follows:
 % ls -la | DT    [... or "| DTo"]
The secret is the "piping" through the DT ( or DTo) command, which executes the redirect alias.

Comments (3)


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