Reputation: 17022
Having a sample function
function functionName ()
{
echo "Hello World"
}
How can I avoid it to be overwritten by a following function with the same name?
function functionName ()
{
echo "this is another function"
}
Upvotes: 4
Views: 1685
Reputation: 17022
You need to use the -f option to make corresponding function readonly and syntax is:
readonly -f functionName
After this, if you ever try to update the function an error will be fired:
bash: functionName: readonly function
Upvotes: 8