<div dir="ltr"><div>Hi list,</div><div><br></div><div>I came across the following neutron client specific syntax and decided to see if I could reproduce using the openstack client and it's flexible formatting capabilities</div><div><br></div><div><br></div><pre style="padding:0px;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-size:14px"><code><font face="monospace, monospace">$ NIC_ID1=$(neutron net-show public | awk '/ id /{print $4}')</font></code></pre>
<div><font face="monospace, monospace">$ echo $NIC_ID1</font></div><div><font face="monospace, monospace">210d976e-16a3-42dc-ac31-f01810dbd297</font></div><div><br></div><div>I can get similar syntax (unfortunately lowercase variable name only) with: </div><div>NOTE: It may be nice to be able to pass an option to UPPERCASE all shell variables names.</div><div><br></div><div><div><font face="monospace, monospace">$ openstack network show public -c id --format shell --prefix nic_ </font></div><div><font face="monospace, monospace">nic_id="210d976e-16a3-42dc-ac31-f01810dbd297"</font></div></div><div><br></div><div>However to use this I effectively have to place in a file and source that file to expose this variable to my current running shell. </div><div>Reproducing the same syntax does not work obviously.</div><div><br></div><div><font face="monospace, monospace">$ NIC_ID2=$(openstack network show public -c id --format shell)</font></div><div><div><font face="monospace, monospace">$ echo $NIC_ID2</font></div><div><font face="monospace, monospace">id="210d976e-16a3-42dc-ac31-f01810dbd297"</font></div></div><div><br></div><div>And even stripping out the "name=" portion still results in a quoted response.</div><div><br></div><div><div><font face="monospace, monospace">$ NIC_ID3=$(openstack network show public -c id --format shell | cut -d= -f2)</font></div><div><font face="monospace, monospace">$ echo $NIC_ID3<br></font></div><div><font face="monospace, monospace">"210d976e-16a3-42dc-ac31-f01810dbd297"</font></div></div><div><font face="monospace, monospace"><br></font></div><div>So in order to accurately reproduce I need the following which seems more long winded then the original.</div><div><br></div><div><div><span style="font-family:monospace,monospace">$ NIC_ID4=$(openstack network show public -c id --format shell | cut -d= -f2 | tr -d '"')</span><br></div></div><div><font face="monospace, monospace"><div>$ echo $NIC_ID4<br></div><div>210d976e-16a3-42dc-ac31-f01810dbd297</div></font></div><div><font face="monospace, monospace"><br></font></div><div>While I presume the intended use to create a file to source variables is there any merit it supporting per variable definition as in this example?</div><div><br></div><div>Any thoughts appreciated.</div><div><br></div><div><br></div><div>Regards</div><div><br></div><div>Ronald</div></div>