Buscar..


No hay cosas tales como espacios de nombres

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 última declaración gana. ¡No hay cosas tales como espacios de nombres! Sin embargo, las funciones pueden contener otras funciones.



Modified text is an extract of the original Stack Overflow Documentation
Licenciado bajo CC BY-SA 3.0
No afiliado a Stack Overflow