bash script regular expression

Mikkel L. Ellertson mellertson at gmail.com
Fri Feb 10 17:50:33 UTC 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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
- -- 
Do not meddle in the affairs of dragons, for thou art crunchy and
taste good with Ketchup!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAk81WOkACgkQqbQrVW3JyMT0TQCfb9SRRFXBKSM7d2xHf6p5f7qy
SEQAn1ejgI2i43jbw/8LkbnQlZX/jWd5
=gOGu
-----END PGP SIGNATURE-----



More information about the users mailing list