Re: bash - safely pass untrusted strings?

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



>  Unless I'm terribly mistaken (again?), the only way I've been able to
>  see "loop thru a list of files" work reliably is with "find" using
>  the "-print0" option, in cahoots with xargs.
>
>  Is there any other way?
>
>
>  -Ben
>  --

If I understand you correctly, you are referring to the problem caused
by spaces in filenames?  Steve mentioned the environment variable IFS
("individual field separator" if memory serves me correctly).  By
default it's space, tab, or newline.  You can change that in your
script to be newline only in order to process file names with spaces
in it, and then change it back afterwards (so save the value of $IFS
at the beginning of the script to something like Default_IFS and then
just prior to exiting the script reassign that value back to IFS to
return it to its original state).  If that's what you are looking at
doing I'm sure someone here can fill in the blanks on that one.  If
not when I get to the office tomorrow I can have a look at some of my
scripts where I had to do that and post sample code for you.

Jacques B.
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux