Matthias Hentges <[EMAIL PROTECTED]> [2002-11-03 18:32:29 +0100]: > Am Son, 2002-11-03 um 04.51 schrieb Neal Lippman: > > I frequently need to execute a command of the form: > > for x in {A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z); do > Your problem ist the wrong setting of the IFS (man bash, search for IFS) > TARGETS="A B C D E F G H I" #set up list of targets > OLD_IFS="$IFS" #remember old IFS > IFS=" " #set IFS to "space" > [...use it...] > IFS="$OLD_IFS" #restore old IFS > > That's how i do it all the time. There may be a better way, but it Just > Works (TM)
The default setting of IFS is "<space><tab><newline>", which I show typed out because none of those are printable. Changing it to a space only would only be needed if something had already previously changed it to something else. I believe suggesting to people that they should set it to a space out of context will be confusing. You would only need to change it to a space if previously you had set IFS to something else that did not contain a space. If they did not do that previously then they do not need to do this here. The problem must be something else. In this case I think it is confusion about walking through a list of items. Bob
msg10782/pgp00000.pgp
Description: PGP signature