[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
Neil Williams wrote: >On Friday 25 November 2005 8:34 pm, Rob Beard wrote: > > >>The bit of code I'm stuck on is: >> >> ls | grep -i cpio | while read fn; do >> >> > >That looks borked to me. > >while read fn >echo $fn >done > >works fine. > >Why are you piping the output of grep to while? > >ls outputs to grep which outputs text. This text should be passed to the if, >not to the while. > >My version would be: > >fn=`ls | grep -i txt` >if [ ! `echo "$fn" | grep -i last` ] > then > echo > echo "Please insert a blank disc in your CD/DVD writer and press >RETURN" > echo "to commence writing disc $diskcount of the backup set." > echo >fi >read first > >You could specify a prompt using read: >read -p "Only return is needed" first > >$ bash t > >Please insert a blank disc in your CD/DVD writer and press >RETURN >to commence writing disc of the backup set. > >Only return is needed >$ > >You aren't expecting input here (I assume), just a keypress so the value of >the read isn't useful? > > > >>Now the problem I'm having is with the read command which is just before >>command used to burn the CD. I've tried using 'read' and I've even >>tried writing a very basic C program which just executes getchar() but >>none of the commands seem to work, they just appear to be ignored. >> >> > >Because it's being expected to react to the pipe. > > > Thanks for the advice Neil, it seems to work how I wanted. I cobbled the script together from examples on the net, hence I thought it could probably be done better. Rob -- The Mailing List for the Devon & Cornwall LUG Mail majordomo@xxxxxxxxxxxxx with "unsubscribe list" in the message body to unsubscribe. FAQ: www.dcglug.org.uk/linux_adm/list-faq.html