On Thursday, Mar 24, 2005, at 15:02 US/Central, Jon Drews wrote:
I got it to work by doing this:

$ Irk=$(xlsfonts | head)

$ for J in $Irk
do
xfd -fn $J
done

but I really wanted the array :-/

Since xlsfonts outputs one font definition per line, you could also use a while loop with a read statement in bash:


$ xlsfonts | head | while read J ; do
    xfd -fn $J
  done

Or use xargs with the "-n 1" option:

$ xlsfonts | head | xargs -n 1 xfd -fn

Or in use awk's implicit while loop:

$ xlsfonts | head | awk '{ system("xfd -fn " $0) } '

If you remove the 'head' portion of the pipeline, you'll get all the fonts. If you really want an array, I'd recommend using perl:

$ xlsfonts | head |
  perl -e '@J=(<>) ;
    for ($i=0 ; $i<=$#J ; $i++) {
      system("xfd -fn $J[$i]")
    } ; '

In the above example, @J is the array of the fonts, $i is the index/counter, and $J[$i]is the $i-th font in array @J.

Regards,
- Robert
http://www.cwelug.org/downloads
Help others get OpenSource software.  Distribute FLOSS
for Windows, Linux, *BSD, and MacOS X with BitTorrent

_______________________________________________
CWE-LUG mailing list
http://www.cwelug.org/ [email protected]
http://lists.firepipe.net/listinfo/cwe-lug

Reply via email to