bash exit command should be unconditional

2010-04-07 Thread Vadym Chepkov
Hi,

I found out a very unusual feature of bash which makes it to act really 
unexpected. I understand that pipelines are executed in a separate subshell, 
but I really think 'exit' command should be absolute. Consider a trivial code:

#!/bin/bash

echo Start
ps -ef | while read proc
do
 echo $proc
 exit 1
done
echo Continue

I would expect never see "Continue" printed, I didn't put any conditional 
checks to simplify the example, but I really expect the script to be completely 
aborted when it gets to 'exit', not having to add additional checks or replace 
pipeline with temporary files

Sincerely yours,
  Vadym Chepkov




Re: bash exit command should be unconditional

2010-04-08 Thread Vadym Chepkov
I certainly have chosen the subject wrong, but I don't want to start a new 
thread now. Please let me backpedal a bit and describe the problem I am trying 
to solve.

A company I work for is trying to migrate their applications to Linux platform 
and have selected RedHat as the vendor. Redhat installs bash as the standard 
shell :
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Jul  7  2009 /bin/sh -> bash

Now, because of the feature in question, scripts that utilize standard /bin/sh 
don't work properly. I afraid my suggestion to go "read the FAQ" with my accent 
some might hear as a profanity :) 

So the question is, is it possible to run bash in "compatible" mode? Maybe some 
flags during compilation were omitted by vendor? 
I can recompile the bash, auditing and rewriting all the scripts is just not 
feasible.

Thank you,
Vadym Chepkov