2021年3月14日星期日

Shell Script - Getting a specified value from returned block

I wish to get the returned value of status with shell then I can process to next command

# glance image-show 0227a985-cb1e-4f0c-81cb-003411988ea5  +---------------------+--------------------------------------+  | Property            | Value                                |  +---------------------+--------------------------------------+  | checksum            | None                                 |  | container_format    | bare                                 |  | created_at          | 2021-03-15T02:54:15Z                 |  | disk_format         | raw                                  |  | hw_disk_bus         | scsi                                 |  | hw_qemu_guest_agent | yes                                  |  | hw_scsi_model       | virtio-scsi                          |  | id                  | 0227a985-cb1e-4f0c-81cb-003411988ea5 |  | locations           | []                                   |  | min_disk            | 0                                    |  | min_ram             | 0                                    |  | name                | not_inuse                            |  | os_hash_algo        | None                                 |  | os_hash_value       | None                                 |  | os_hidden           | False                                |  | os_require_quiesce  | yes                                  |  | owner               | 4d97a99e53bd4b51aa58601985776d5c     |  | protected           | False                                |  | size                | None                                 |  | status              | active                               |  | tags                | []                                   |  | updated_at          | 2021-03-15T02:54:30Z                 |  | virtual_size        | Not available                        |  | visibility          | private                              |  +---------------------+--------------------------------------+  

How do I get the printed value = active ??

# glance image-show 0227a985-cb1e-4f0c-81cb-003411988ea5 | grep status  | status              | active                                                                           |  

Please help, Thank you

https://stackoverflow.com/questions/66631869/shell-script-getting-a-specified-value-from-returned-block March 15, 2021 at 11:06AM

没有评论:

发表评论