On Mon, Nov 25, 2019 at 10:04:11PM +0000, Teodoro Santoni wrote: > Hi marc!
hi Teodoro! thanks for replying. > I forgot, then remembered this old trick from the Rc paper, by Tom Duff [1]: > [1]: http://doc.cat-v.org/plan_9/4th_edition/papers/rc shame on me: this page is actually open in my browser and i didn't get the trick. on the other end: i indeed was missing something :) > % ifs=' > ' > % pages=`{ls *.md | sed 's/\.md$/.html/g'} > Simply set ifs to the newline during the expansion of your files and > you're done. cool.. i mixed it with another rc goodness: it's really easy to localize a variable to a block so you don't touch the global copy foo=a foo=b { echo $foo } echo $foo gives b a also, as rc has no expansion capability, i had to "restream" $sources. i tried $sources^' ' but the space separator is added in front of elements (which is expected but anoying in this case). so i came to the conclusion i need files to store the lists. i got: store=`{mktemp -d /dev/shm/XXXXX} ls *.md |tee $store/sources | sed ' s/md$/html/ s,^,pub/, ' > $store/targets ifs=' ' { sources=(`{cat $store/sources}) targets=(`{cat $store/targets}) } for (i in `{seq $#sources} ) echo $sources($i) ' => ' $targets($i) rm $store i finally gave a try on using fifos but this does't work... store=`{mktemp -d /dev/shm/XXXXX} mkfifo $store/^(sources targets) ifs=' ' { sources=(`{cat $store/sources}) targets=(`{cat $store/targets}) } & ls *.md |tee $store/sources | sed ' s/md$/html/ s,^,pub/, ' > $store/targets wait for (i in `{seq $#sources} ) echo $sources($i) ' => ' $targets($i) about work: that's the thing i'm supposed to do now so .. thanks for your help and have a nice day. regards marc