[Anthill-pro] Shell and failing script doubt

Varban vvv at urbancode.com
Mon Apr 7 07:15:40 CDT 2008


Emerson,

the easies solution would be to expand your shell script to check the 
output of the egrep command and it it is empty return the correct exit 
code so you won't have to even deal with a custom post-processing script.
Something like

if [ -z `egrep @[a-zA-Z0-9__]+@ ./target/resources/*.*` ]; then
         exit 0
else
	exit 1
fi

should do the trick

Regards,
Varban


emerson cargnin wrote:
> Hi All
> 
> I have a job library to pre-process our resources depending on the
> environment. I then run a shell script to check if there is any
> property not merged. I use the following shell script:
> 
> egrep @[a-zA-Z0-9__]+@ ./target/resources/*.*
> 
> This shouldn't return anything if all properties are merged (no @XXX@
> left in the files). I then execute the following beanshell failing
> script:
> 
> return Fail.unless(
>    Logic.and(
>     Logic.not(Output.contains("target/resources/")),
>      ExitCode.is(0)
>     )
>    )
> 
> because there is no pattern string to verify for failing, then I check
> if the root folder appears on the log and fail based on this.
> 
> Now... It happens that it is failing even if when I run it manually it
> doens't returns anything. I'm suspecting that the command is present
> on the log as well, which then makes the script fail as if it was the
> result of the command.
> 
> How could I change it so that it will fail only when I get any results
> from my script?
> 
> Thanks
> Emerson
> _______________________________________________
> Anthill-pro mailing list
> Anthill-pro at lists.urbancode.com
> http://lists.urbancode.com/mailman/listinfo/anthill-pro


More information about the Anthill-pro mailing list