Recherche…


Il n'y a pas de choses comme les espaces de noms

myfunc(){
    echo "I will never be executed."
}
another_func(){
    # this "redeclare" overwrites original function
    myfunc(){ echo "I am the one and only"; }
}
# myfunc will print "I will never be executed"
myfunc
# but if we call another_func first
another_func
# it gets overwritten and
myfunc
# no prints "I am the one and only"

La dernière déclaration gagne. Il n'y a pas de choses comme les espaces de noms! Cependant, les fonctions peuvent contenir d'autres fonctions.



Modified text is an extract of the original Stack Overflow Documentation
Sous licence CC BY-SA 3.0
Non affilié à Stack Overflow