On Saturday 12 March 2011 19:00:56 Dan McGhee wrote:
> # This one recovers from failed "make."
> if [ -e $logdir/make-`echo $package`.err ] && \
> [ ! -e $logdir/install-`echo $package`.err ]; then #Now build
>
> <removed "make," "make check" and "make install" sections>
> fi
>
> # This one recovers from a failed install
> if [ -e $logdir/make-`echo $package`.log ] && \
> [ ! -e $HOME/$package-files.list ]; then
Technically, you may be mixing metaphors with this syntax. Perhaps the syntax
is valid, but it isn't doing what you expect. Try:
if [ -e "file_1" -a ! -e "file_2" ]; then
<commands>
fi
# equivalent: if test -e "$file_1 -a ! -e file_2; then
OR use:
[ -e "file_1" ] && [ ! -e "file_2" ] && {
<commands>;
}
# equivalent: test -e "$file_1 && test ! -e file_2 && {
OR even use:
[ -e "file_1" -a ! -e "file_2" ] && {
<commands>;
}
# equivalent: test -e "file_1" -a ! -e "file_2" && {
Also, the syntax '-e "$logdir/make-${package}.log"' will eliminate a smidgeon
of complexity even though what you did is correct. Any time you aren't sure if
a shell var like $var will be, or is being, parsed correctly in context, put
the name in braces, as in ${var}.
Nothing else on your script pokes me in the eye with a sharp stick.
--
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page