Re: Adding to the command line via variables
From: Chris F.A. Johnson (cfajohnson_at_gmail.com)
Date: 07/31/05
- Next message: Mr. Question: "Recursively delete all subdirectories"
- Previous message: Greg Andrews: "Re: Adding to the command line via variables"
- In reply to: Greg Andrews: "Re: Adding to the command line via variables"
- Next in thread: Greg Andrews: "Re: Adding to the command line via variables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 30 Jul 2005 21:21:13 -0400
On 2005-07-31, Greg Andrews wrote:
> cfajohnson@gmail.com writes:
>>
>> Unless you need a regular expression to select the files, there is
>> no need for ls or grep. To print all the files beginning with
>> "output", just use:
>>
>>lp -d printername output*
>>
>
> That's a good approach, but there is one caveat: Some of the SVR4
> derived print systems (where the "lp" command came from) have limits
> on the number of files that can be printed in each lp command.
>
> On Solaris 2.3 through Solaris 99, the limit is something like 52 or 56.
> I don't know if Solaris 10 has expanded that limit.
The OP said:
>>> I don't expect to ever exceed the allowable count of command line
>>> parameters.
However, if there is a problem, they can be processed one or more
at a time:
for f in output* ## One at a time
do
lp -d printername $f
done
set -- output*
while [ $# -gt 9 ] ## Nine at a time
do
lp -d printername "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
shift 9
done
[ $# -gt 0 ] && lp -d printername "@"
--
Chris F.A. Johnson <http://cfaj.freeshell.org>
==================================================================
Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
<http://www.torfree.net/~chris/books/cfaj/ssr.html>
- Next message: Mr. Question: "Recursively delete all subdirectories"
- Previous message: Greg Andrews: "Re: Adding to the command line via variables"
- In reply to: Greg Andrews: "Re: Adding to the command line via variables"
- Next in thread: Greg Andrews: "Re: Adding to the command line via variables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]