我有一個命令,當我運行它時,它輸出一個表,看起來像;Bash追加到數組元素的末尾
Id Name File OS Version Annotation
10 MICKEY [MICKEY_01_001] MICKEY/MICKEY.vmx windows8Server64Guest vmx-08
13 DONALD [DONALD_01_001] DONALD/DONALD.vmx windows7Server64Guest vmx-10
2 GOOFY [GOOFY_01_001] GOOFY/GOOFY.vmx windows9Server64Guest vmx-09
我那麼表存儲在數組中調用表並列出表數組,代碼如下所示;
readarray -t TABLE <<< "$(command)"
IFS='|'
for i in "${TABLE[@]}"
do
echo $I
done
如何附加到每個數組元素的末尾?我想要表格如下所示;
Id Name File OS Version Annotation
10 MICKEY [MICKEY_01_001] MICKEY/MICKEY.vmx windows8Server64Guest vmx-08 ON
13 DONALD [DONALD_01_001] DONALD/DONALD.vmx windows7Server64Guest vmx-10. OFF
2 GOOFY [GOOFY_01_001] GOOFY/GOOFY.vmx windows9Server64Guest vmx-09. ON
中,我相信有,你可以檢查一些存在的問題。例如:https://stackoverflow.com/questions/12744031/how-to-change-values-of-bash-array-elements-without-loop – dbalakirev
ON,OFF,ON從哪裏來? –