Skip to Content.
Sympa Menu

baslinux - Re: [BL] double sided printing script

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: "David Moberg" <davidjmoberg AT gmail.com>
  • To: baslinux AT lists.ibiblio.org
  • Subject: Re: [BL] double sided printing script
  • Date: Thu, 23 Mar 2006 11:19:05 -0800

sindi keesan wrote:
> I got help from someone who took a linux course.
>
> Scripts to print even or odd pages only:
>
> printeven:
>
> #!/bin/sh
> for i in *[0,2,4,6,8].pbm; do pbmtolj $i > /dev/lp0; done
>
> Turn over and reinsert stack of paper, if needed reverse order of pages.
>
> printodd:

I read this as 'print to dd'. Might want to put an underscore in there.

> Can I specify 'odd number' instead of writing them all out?

No, that's not a supported character list, even in bash.

> I tested with 'echo' instead of pbmtolj and got 01 03 11 33 (ascending).
> I got the same output with [9,7,5,3,1]. How do I specify descending
> numerical order in a script?

Why not nest the loop inside of another one?

#!/bin/sh
for x in `seq 9 -2 1`
do
for i in *$x.pbm; do pbmtolj $i > /dev/lp0; done
done

(`seq 9 -2 1` is the same as 9 7 5 3 1
`seq 1 2 9` is the same as 1 3 5 7 9)

David




Archive powered by MHonArc 2.6.24.

Top of Page