On Wednesday 23 October 2002 10:04 pm, Todd A. Jacobs wrote:
> I spend a lot of time on the Moongroup shell.scripting list at:
>
>     http://moongroup.com/mailman/listinfo/shell.scripting

cool, i just joined that.

> You can't do that. Bash has a builtin variable ("$?") for holding the exit
> status, which you can then reassign to another variable if you need to
> store it for later use. For example:
>
>       x=$?

ok, but what if i want to capture the exit status of grep in the following 
command:
grep "test" testfile.txt | tee test.out
in that case $? always == 0, regardless of the exit status of grep.

> or you can just test the exit status directly with conditional expressions
> such as:
>
>       ./configure && make && make install
>       make uninstall || echo "Help me, I've failed and I can't get up!"

whoot, this will work for my purposes i think, but i'm a c/c++ programmer and 
i like to my bash scripts to reflect my way of thinking/programming in 
c...haha...;)

my exact problem is that i want to make a shell script to compile and install 
KDE from source.  the problem is that sometimes ./configure will exit 
successfully even if some packages aren't detected (i.e. the target package 
will compile, but some features will be disabled).  i do not want to compile 
unless ALL features are enabled.  so i was thinking i could test not only if 
configure exited successfully, but also tee its output to a file and grep it 
for any warnings about missing packages before i go on to compile it.

thanks Todd and everyone else for your help and input,
christopher



-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@;redhat.com?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to