[PVE-User] using virt-viewer in bash withouth sed and awk...

Dietmar Maurer dietmar at proxmox.com
Mon Mar 17 11:44:25 CET 2014


> > But depending on attribute order is bad, so I would use the following
> > instead:
> >
> > TICKET=${DATA//\"/}
> > TICKET=${TICKET##*ticket:}
> > TICKET=${TICKET%%,*}
> >
> > CSRF=${DATA//\"/}
> > CSRF=${CSRF##*CSRFPreventionToken:}
> > CSRF=${CSRF%%,*}
> >
> > I guess that would also work?
> 
> Of course but the script works even if the attribute order SHOULD be good

Sorry, I do not understand that. You do:

TICKET=${TICKET%%,username*}

So this will only work if ticket is followed by username. But there is no guaranteed for that.

> you have the same problem with sed

I cannot see that problem with sed? 


More information about the pve-user mailing list