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

  • Migs351

    Migs351

    3 HAZİRAN 2007
  • sghaff1

    sghaff1

    23 Mart 2009
  • The Weavers of Eternity Paracord Tutorials

    The Weavers

    1 Ocak 2014