[Gloucs] bash question

Keith Edmunds kae at midnighthax.com
Tue Nov 30 21:05:35 UTC 2010


On Tue, 30 Nov 2010 20:43:48 +0000, glynd at walmore.com said:

> if n is 1, $n returns 1. I want to use n to cycle through the command
> line arguments so I end up with $$n the idea being $1 is the first
> command line argument so $n would return 1, leaving $1 which return
> the 1st command line argument.

I think you're looking for double indirection. For example:

$ dog="cat"
$ cat="mouse"
$ echo $dog
cat
$ echo ${!dog}
mouse
$

Is that what you were looking for?

However, I don't think you even need that. How about something like
(completely untested, and intended to be run from the directory
containing the PDFs):

$ for infile in *pdf;do gs -o /path/to/outputfile.pdf $infile;done

Make sure the outputfile.pdf is NOT in the directory with the source PDFs.

Does that help?

Keith
-- 
Keith Edmunds

+-------------------------------------------------------------------------+
|    Tiger Computing Ltd    |  Helping businesses make the most of Linux  |
|  "The Linux Specialists"  |       http://www.tiger-computing.co.uk      |
+-------------------------------------------------------------------------+



More information about the gloucs mailing list