Verifiying commands entered

Dan Nicholson dbn.lists at
Thu Oct 19 07:04:04 PDT 2006

On 10/19/06, Matt.Koll at <Matt.Koll at> wrote:

> I am building with the LiveCD and have made it to Chapter 5.11.1 GCC
> build Phase 2.
> I am at the point of running the commands for the fixinclude scripts.
> I have entered it as provided in the book, but would like to check that
> the command was actually successful.

These are stored in the shell. `echo $?' will show you the exit status
of the last command. If the previous command was a pipeline (command |
grep foo), then the exit status of each command in the pipeline is
stored in an array variable called PIPESTATUS. So, to see if the whole
pipe was successful, you can do `echo ${PIPESTATUS[*]}'.

It's a good habit to check $? if the command didn't provide visual
indication of success/failure. The LFS book is written such that all
the commands should be successful. I think there are only a couple
exceptions, i.e. the glibc testsuite always returns as a failure.


More information about the lfs-support mailing list