ind-func.sh

来自「Shall高级编程」· Shell 代码 · 共 24 行

SH
24
字号
#!/bin/bash# ind-func.sh: Passing an indirect reference to a function.echo_var (){echo "$1"}message=HelloHello=Goodbyeecho_var "$message"        # Hello# Now, let's pass an indirect reference to the function.echo_var "${!message}"     # Goodbyeecho "-------------"# What happens if we change the contents of "hello" variable?Hello="Hello, again!"echo_var "$message"        # Helloecho_var "${!message}"     # Hello, again!exit 0

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?