Re: bash help setting variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Oct 17, 2009 at 11:58:12 -0700,
  Donald Russell <russell.don@xxxxxxxxx> wrote:
> I'm trying to write a bash script which makes an inquiry to an http
> service that replies with a series of keyword=value plain text data,
> one pair per line.
> I want to extract only a few of the lines, and make variables of them
> available to rest of my bash script.

I wrote something to pull some values out of xml data returned by svn that
has a few similarites to what you were doing.

One key thing was handling multiple values returned by one command. I ended
up using arrays for this. They need to be escaped more carefully, but it
seemed better than running the command one for each returned value.

I use the following to get a couple of values:
REV=(`svn info -r $1 --xml --incremental $COLOSSUS | xsltproc colossus-rev.xsl -
`)

And then I use them like this:
svn export -q -r ${REV[1]} $COLOSSUS colossus-${BNAME}-${REV[0]}-${REV[1]}

This is from the colossus srpm and you can look at it if you want to see
more of the example.

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux