Ricardo

Bash while read 逐行处理

阅读时长: 1 分钟
Bash
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
get_pod="NAME    READY   STATUS    RESTARTS   AGE
pod-a   2/2     Running   0          6h
pod-b   2/2     Running   0          5h
pod-c   2/2     Running   0          4h
pod-d   2/2     Running   0          3h"

IFS="\n"

while read line;
do echo $line;
done <<< $get_pod
Licensed under CC BY-NC-SA 4.0
comments powered by Disqus
记录自己
Built with Hugo
主题 Stack 由 Jimmy 设计