bash script regular expression

Kevin Martin kevintm at ameritech.net
Fri Feb 10 19:17:39 UTC 2012



On 02/10/2012 11:50 AM, Mikkel L. Ellertson wrote:
>
> On 02/10/2012 11:07 AM, Aaron Konstam wrote:
> > On Thu, 2012-02-09 at 23:31 -0800, Alejandro Rodriguez Luna wrote:
> >> Hi everyone, I was creating a script and i found something i can't
> >> figure out.
> >>
> >> #/bin/bash
> >> for i in $(cat certificates.txt)
> >> do
> >> echo $i
> >> done
> >>
> >> I expected this
> >>
> >> RSA Secure Server Certification Authority
> >> VeriSign Class 1 CA Individual Subscriber-Persona Not Validated
> >>
> >>
> >> but i got this
> >>
> >> RSA
> >> Secure
> >> Server
> >> Certification
> >> Authority
> >> VeriSign
> >> Class
> >> 1
> >> CA
> >> Individual
> >> Subscriber-Persona
> >> Not
> >> Validated
> >>
> >> any ideas how to fix this? i mean, how can i get the whole line
> >> instead of word by word?
>
> Try adding:
>
> IFS=
>
> before the do command and see if that does it for you.
>
> Mikkel

>

Can't do it directly in front of the do statement, but if you put it in front of the whole if statement, then the parsing works. 
*Now* I have to research what that is doing!  Thanks for making me learn something today!  :-)

Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.fedoraproject.org/pipermail/users/attachments/20120210/a998fafd/attachment.html>


More information about the users mailing list