Neal Murphy wrote:
> On Friday 02 July 2010 15:11:31 Face wrote:
>   
>> well, thank you all, i will start over and see what will happen.
>> I am using a shell script to do the book if someone could take a look
>> at it, that would be nice .
>>
>>
>> Sincerely
>>     
>
> Ah, you don't seem to have error detection in your script.
>
> After many of your actions, you could put
>   || (echo "'action' failed."; exit 1)
>
> For example:
>   tar -jxf ../mpfr-2.4.2.tar.bz2  >>$Logs || \
>     (echo "Extracting mpfr failed."; exit 1)
>   mv -v mpfr-2.4.2 mpfr | source $Msg || \
>     (echo "Renaming mpfr failed."; exit 1)
>
>
> Also 'man bash' and read up on the 'trap' built-in. You can do something like:
>   trap "echo \"'action' failed!\"; exit 1" ERR; action-to-take; trap "" ERR
>
> For example:
>   trap "echo \"Extracting mpfr failed.\"; exit 1" ERR
>   tar -jxf ../mpfr-2.4.2.tar.bz2  >>$Logs
>
>   trap "echo \"Renaming mpfr failed.\"; exit 1" ERR
>   mv -v mpfr-2.4.2 mpfr | source $Msg
>
>   trap "" ERR
>
>
> You might have to change the script to use bash instead of sh.
>
> Cleverly crafted, you should be able to catch most of the errors when they 
> happen while maintaining a readable script.
>   
If using bash a simple:

#!/bin/bash -e
set +h

at the top of the script works, bails on any error
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to