Peter Memishian wrote:
>  > Consider the output for show-linkprop -c.  There are quotes around all 
>  > values.  While this provides consistency among the format of all possible 
>  > values of all possible properties (as some values may contain spaces), 
>  > it's not obvious to parse.  At least not for me.  How do I easily strip 
>  > the " characters from around a value in a shell script?
> 
> One easy way is to use `eval'.  For example, with my new ipmpstat command:
> 
>   get_existing_groupifname()
>   {
>         /sbin/ipmpstat -g -o groupname,group -PF | while read name ifname; do
>                 if [ $name = \"$1\" ]; then
>                         # eval disposes of the surrounding double-quotes.
>                         eval echo $ifname
>                         break;
>                 fi
>         done
>   }
> 
> BTW, the "-F" option strips the `FIELD=' part -- but I'm starting to think
> it would make more sense to have the fieldnames stripped by default
> whenever -o is used with parseable mode.

Right, I think we'd thrown this idea around before.  It makes sense to 
me.  If the caller asked for specific fields in a specific order, then 
tagging the values shouldn't be necessary for parsing.

-Seb

Reply via email to