executing per line output of script
Just wondering if anyone had a thought on how to accomplish this. du -k prints the results in kilobytes. In this particular instance, I know all of the sub-directories are in gigabytes and wanted to print out the results that way. So, I tried the following expecting "f" to be set to each line of output. Instead, bash returned all the output in one line and broke it up by white space.
Code:
for f in $(du -k -s *); do |
Found a solution with the help of Google. :) See process output of command line-by-line
I tried piping the output of du to "while read f; do," but that was failing with bash trying to execute the first directory size as a command. I then tried setting the IFS variable to a new line and re-ran my code. That time it worked! :) |
All times are GMT -5. The time now is 03:28 PM. |