SORU
12 Aralık 2010, Pazar


Dönüş ve BASH fonksiyonları çıkış arasındaki fark

Çıkış kodları açısından BASH fonksiyonları return exit deyim arasındaki fark nedir?

CEVAP
12 Aralık 2010, Pazar


Olarak, return akım fonksiyonu exit script denir noktada sonuna neden olacak kapsam dışına gitmesine neden olacaktır kaydetti. İşte bunu açıklamak için bir örnek program:

#!/bin/bash

retfunc()
{
    echo "this is retfunc()"
    return 1
}

exitfunc()
{
    echo "this is exitfunc()"
    exit 1
}

retfunc
echo "We are still here"
exitfunc
echo "We will never see this"

Çıktı

$ ./test.sh
this is retfunc()
We are still here
this is exitfunc()

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • GALERNAYA20

    GALERNAYA20

    19 NİSAN 2011
  • Louis C.K.

    Louis C.K.

    18 HAZİRAN 2006
  • Matus Slovak

    Matus Slovak

    5 Temmuz 2007