Search code examples
cygwin

How do I get a cygwin script to output to file?


I need to get the results of this to output to a file, but have no idea what command to use - any ideas please?

input="/cygdrive/c/dev/test/need_file_size.csv"
trunkRoot=/cygdrive/c/dev/trunk/test-trunk
outputFile=/cygdrive/c/temp/findSizes.log

while read row; do
        class=$(echo $row | cut -f 2 -d ",")
        find $trunkRoot/ -name "${class}.java" | xargs ls -long          
done < "$input"

Solution

  • input="/cygdrive/c/dev/test/need_file_size.csv"
    trunkRoot=/cygdrive/c/dev/trunk/test-trunk
    outputFile=/cygdrive/c/temp/findSizes.log
    
    while read row; do
            class=$(echo $row | cut -f 2 -d ",")
            find $trunkRoot/ -name "${class}.java" | xargs ls -long >> filename          
    done < "$input"
    

    Notice the append to filename or run the script and do it

    ./myscript >> filename