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

  • Jaclyn W

    Jaclyn W

    5 Mayıs 2006
  • Perihelion

    Perihelion

    23 NİSAN 2008
  • TopDJMag TV

    TopDJMag TV

    29 Temmuz 2010