PLEX86  x86- Virtual Machine (VM) Program
 Plex86  |  CVS  |  Mailing List  |  Download  |  Linux  |  Newsgroups

iterating over bash script params, preserving whitespace 7262


Your Ad Here

Your Ad Here

RPM creation questions
Why should there be a file INSTALL inside the rpm, and why should it contain any commands? Have a look at some existing source rpm files, install them, read the spec file, and figure out...

On Mon, 19 Dec 2005 23:19:04 +0000, Paul Colquhoun

thanks - I'll give that one a try.

My other thought is to use some non-space character to indicate space, but escape any legitimate occurances within the parameters. (the nature of the parameters are such that I can expect space characters in there, but not tabs or other characters which might be considered as parameter delimeters)

e.g.

1) within first script, escape all single occurances of '' in parameter with '' (easy using sed)

2) within first script, replace any space char with a single '' character (again, easy using sed)

3) call second script, pbutting 'encoded' parameter.

4) within second script, replace any *single* occurance of '' with space character.

5) within second script, replace any occurance of '' with '' (sed again)

Step 4's the only bit I'm puzzling over (I'm no sed expert at all - I've only ever needed to do the basic stuff). I'd need something that can replace any instance of '' except when there's another '' beside it before or after (which of course also needs to work at parameter start or end, where there may not be a before or after character). There's probably some magical incantation to sed which expresses this, but I haven't found out what it is yet :)

As the 'second' script is only ever called by the 'first' one rather than in isolation, it's not a problem to expect it to only accept 'encoded' parameters.

cheers

Jules



Your Ad Here

List | Previous | Next

RPM creation questions

Linux groups from Newsgroups

The #1 Usenet Provider on the Internet

iterating over bash script params, preserving whitespace 7261