Operating Systems :: Unix :: output to screen |
|||
| By: roe1and |
Date: 29/04/2008 11:17:28 |
Points: 20 | Status: Answered Quality : Excellent |
|
if i do: du -ak it prints a list of all the files in a directory and the size of those files. if i do this: du -ak > list.txt the output goes straight into a text file called list.txt my question is: can i output to both screen and textfile simultaneously? |
|||
| By: VGR | Date: 30/04/2008 22:38:33 | Type : Comment |
|
| okkkkk first, you could write a two lines shell script (the second being "cat list.txt"). then, you could try piping shell commands in stead of redirecting output you could probably even pipe your above command to "cat", on one single line those were cheap ideas ;-) personally, I would write a shell script, it'll be more portable than an obscure single liner. sorry, I don't have a unix system under hand and can't test. |
|||
| By: roe1and | Date: 01/05/2008 10:39:02 | Type : Comment |
|
| thanks for the input. i'm running a huge shell script and wanted to monitor the progress onscreen. i've decided though that as long as there are no error messages i should be ok! | |||
| By: VGR | Date: 02/05/2008 09:50:27 | Type : Answer |
|
| well... as for me, I don't code any more shell scripts in any OS-level C-like language (bash for instance) mainly because they're incompatible between each other (and very limited, you realize this now ;-) and neither do I code windows-specific Win API programs. May-be you could do like me. I do everything in PHP in CLI mode. It requires only one or two files to be copied to the executables path, and voila, it works. A bit like perl (on windaube, you copy perl.exe in your path and you can run perl scripts ; it's the same for the same footprint for PHP, but PHP is better suited for all-around tasks) in CLI mode, you can force output by flush()ing (or fflush()ing if to a file), you can monitor external calls for completion, you natively have access to databases... and it's faaaast. monitoring a huge shell script from an other shell script is doomed in my humble opinion. good luck |
|||
| By: roe1and | Date: 02/05/2008 11:39:52 | Type : Comment |
|
| i agree. i'll try to convert everything to php next week. i'll let you know how far i get. i might need some clarification on one or two points. thanks again! |
|||
|
Do register to be able to answer |
|||
| Add This Article To: | |||
| |
|
|
|
| |
|
|
|









