I am making a bash script where I need to wait for a reply from a command which matches a string; until then, we need to run the below command. Once we get it, I need to assign that reply to a variable.
The command is as below
/bin/oci --profile $USER compute instance list-vnics --instance-id $INSTANCEOCID | grep -oP 'ocid1.vnic[^"]+'
the reply will come as example
ocid1.vnic.oc1.ap-mumbai-1.amaaaaaakfvuezyaagala7nf53zeomzarbf2h24a2lynp7sgin7ujrkr7jla
Once I get this reply, I need to assign it to a variable VNIC so later in script it can be called as echo $VNIC
How can I do that?