[KLUG Members] To shell or not to shell...

Adam Williams members@kalamazoolinux.org
Mon, 15 Jul 2002 15:17:49 -0400 (EDT)


>This just might help you.... I ls -al a directory into a temp file, then
>read it back to extract filenames to transmit via email. Hopes this helps...
>#!/bin/bash
>while read temp; do
>        echo -n "sending $temp to ec.up.com "
>        cat $temp | mail -s **EDI** UPTEDI@ec.up.com
>        echo "Done"
>        mv $temp sent
>        let num=num+1
>        sleep 5
>done < /tmp/ra96e
>The read command will pickup the line from the file /tmp/ra96e one line
>at a time and continues until it reaches the eof.

I'm pretty sure that read actually scans until the first occurance of
whitespace,  not neccesarily the end of line "\n".  So filenames with
whitespace in them will mess this up.

Do you do an "ls -al" or an "ls -1"?