📜  将变量传递到数组 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:49:59.338000             🧑  作者: Mango

代码示例1
resnuml=`cat h2.pdb | awk '{print $5}' | uniq` # get uniq pattern like 
echo resnuml : 10 11 12 13 14 15

Aresnum=( $resnuml ) # assigning above values into array

echo length : ${#Aresnum[@]}   # Array length. = 6
echo resnums :  ${Aresnum[@]}   # = 10 11 12 13 14 15
echo resnum 0:  ${Aresnum[0]}  # = 10