ex78.sh

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

SH
29
字号
#!/bin/bash# Indirect variable referencing.# This has a few of the attributes of references in C++.a=letter_of_alphabetletter_of_alphabet=zecho "a = $a"           # Direct reference.echo "Now a = ${!a}"    # Indirect reference.# The ${!variable} notation is greatly superior to the old "eval var1=\$$var2"echot=table_cell_3table_cell_3=24echo "t = ${!t}"                      # t = 24table_cell_3=387echo "Value of t changed to ${!t}"    # 387#  This is useful for referencing members of an array or table,#+ or for simulating a multi-dimensional array.#  An indexing option (analogous to pointer arithmetic)#+ would have been nice. Sigh.exit 0

⌨️ 快捷键说明

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