Yanıtlar:
man bash diyor:
? Expands to the exit status of the most recently executed fore‐
ground pipeline.
Ve:
The return status of a pipeline is the exit status of the last command,
unless the pipefail option is enabled.
$?Bir boru hattında son çalıştırılan komutun durumunu korur, ancak kullanmak boru hattı içinde bir komutun durumunu kontrol etmek istiyorsanız PIPESTATUSolduğunu değişkeni,
En son yürütülen ön plan boru hattındaki (yalnızca tek bir komut içerebilen) işlemlerden çıkış durum değerlerinin bir listesini içeren bir dizi değişkeni (bkz. Diziler).
Örneğinizde, iade durumu git diffokunabilir ${PIPESTATUS[0]}.