- 论坛徽章:
- 0
|
在shell下面执行命令gluster volume info,得到的结果如下:
Volume Name: volume1
Type: Distribute
Volume ID: 6304e435-9856-4503-b0a8-161a12f11181
Status: Started
Number of Bricks: 1
Transport-type: tcp
Bricks:
Brick1: 192.168.2.12:/mnt/zhanshen_vol1
Volume Name: volume_test
Type: Distribute
Volume ID: 0cb10e77-6c79-4c4d-b6bc-7256389edfa9
Status: Started
Number of Bricks: 4
Transport-type: tcp
Bricks:
Brick1: 192.168.2.11:/home/zhanshen/volume_test
Brick2: 192.168.2.13:/home/zhanshen/volume_test
Brick3: 192.168.2.10:/home/zhanshen/volume_test
Brick4: 192.168.2.15:/home/zhanshen/volume_test
Volume Name: volume3
Type: Distribute
Volume ID: d9ee6724-d89e-4b04-a3a7-705fc0350c5f
Status: Started
Number of Bricks: 10
Transport-type: tcp
Bricks:
Brick1: 192.168.2.10:/mnt/zhanshen_vol10
Brick2: 192.168.2.11:/mnt/zhanshen_vol10
Brick3: 192.168.2.12:/mnt/zhanshen_vol10
Brick4: 192.168.2.13:/mnt/zhanshen_vol10
Brick5: 192.168.2.14:/mnt/zhanshen_vol10
Brick6: 192.168.2.15:/mnt/zhanshen_vol10
Brick7: 192.168.2.16:/mnt/zhanshen_vol10
Brick8: 192.168.2.17:/mnt/zhanshen_vol10
Brick9: 192.168.2.18:/mnt/zhanshen_vol10
Brick10: 192.168.2.19:/mnt/zhanshen_vol10
然后我把命令执行的结果保存在变量里面,打印这个变量,换行符全部不见了。
我想实现的功能是根据Valume Name的值来获取它下面的Brick的ip保存在数组里面,然后获取ip地址后面的目录保存在变量里面,请问要怎么处理? |
|