PHP in the Command Line
By Robert Plank2005-05-25
Pipe down over there
Type this in: echo `date +%Y`
Gives us "2004". You could even do something like this: echo `dir`
Which puts the directory listing all on one line.
But now, we put our newfound knowledge to good use. Unix has another neat feature called piping, which means "take everything you would normally output to the screen here, and shove it whatever file I tell you to." So say I had something like this:
echo "hey" > test.txt
Now type "dir" and you'll see a new file, test.txt, that wasn't there before. View it off the web, or FTP it to your computer, do whatever you have to, to read the file. It should contain the word "hey".
Likewise, dir > test.txt would store the directory listing into "test.txt".
Tutorial Pages:
» Listen closely and you'll hear the ocean
» Pipe down over there
» Here today, gone tomorrow
» Put it together
» Arguments (not the shouting kind)
