Environment:  Bash 3.00.14(1) running on i386 under Fedora Core 3 Linux.

In Bash 3.00, it seems that the return code from bash is not
duplicated from a command specified by -c if the command starts with
"!".

To reproduce this, write a script:

        #! /bin/bash

        set -x

        bash --version

        # Create a file baz containing one line containing @.
        cat >baz <<EOF
        @
        EOF

        grep @ baz ; echo $?

        ! grep @ baz ; echo $?

        bash -c "grep @ baz" ; echo $?

        bash -c "! grep @ baz" ; echo $?

        exit

The output it generates is:

        + bash --version
        GNU bash, version 3.00.14(1)-release (i386-redhat-linux-gnu)
        Copyright (C) 2004 Free Software Foundation, Inc.
        + cat
        + grep @ baz
        @
        + echo 0
        0
        + grep @ baz
        @
        + echo 1
        1
        + bash -c 'grep @ baz'
        @
        + echo 0
        0
        + bash -c '! grep @ baz'
        @
        + echo 0
        0
        + exit

In the final test, 'bash -c "! grep @ baz"', the command '! grep @
baz' returns 1, but bash returns 0.

Dale


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to