help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] Option execfail does not work in subshells


From: R. Diez
Subject: [Help-bash] Option execfail does not work in subshells
Date: Tue, 8 Aug 2017 11:51:11 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

Hi all:

When I run this test script:


#!/bin/bash

test ()
{
  shopt -s execfail
  exec "non-existing-command"
  echo "This message should therefore always appear."
}

test
(test)
test &



The output is:

$ ./execfail-test.sh
./execfail-test.sh: line 6: exec: non-existing-command: not found
This message should therefore always appear.
./execfail-test.sh: line 6: exec: non-existing-command: not found
./execfail-test.sh: line 6: exec: non-existing-command: not found


That is, it looks like execfail is being ignored in the subshells.

Is that a bug? Or have I missed something?

Thanks in advance,
  rdiez



reply via email to

[Prev in Thread] Current Thread [Next in Thread]