Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
具有示例功能
function functionName () { echo "Hello World" }
如何避免它被具有相同名称的以下函数覆盖?
function functionName () { echo "this is another function" }
您需要使用 -f 选项将相应的函数设为只读,语法为:
readonly -f functionName
在此之后,如果您尝试更新函数,则会触发错误:
bash: functionName: readonly function