Bu Bash işleri pasajı:Neden "yerel" bir komutun dönüş kodunu süpürüyor? Beklediğim etmezdi
$ fun1() { x=$(false); echo "exit code: $?"; }
$ fun1
exit code: 1
Ama bu, local
kullanarak değil: local
komutunun dönüş kodu süpürmek yok neden
$ fun2() { local x=$(false); echo "exit code: $?"; }
$ fun2
exit code: 0
kimse açıklayabilir ?
genellikle tanımlamak ve tek bir satırda bir değişken kullanmayı tercih https://lists.gnu.org/archive/html/bug-bash/2010-03/msg00007.html – tokland