DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Very nice! :-)
I admit, I haven't looked very closely at it yet, but here is a tipp you
may want to consider:
One of the things I myself learned only very recently was to use the Bash
way of manipulationg strings and substrings contained in variables. (I
used to resort to a lot of sed and awk as well -- and still like it for
better readability, because i'm not yet very fluent with the Bash way --
but sometimes it is not good to have 3 or more external processes started
for every little script, when Bash could do it all itself. And since you
are not caring much for portability, and doing an explicit Bash
thingie...)
See the man page, look for "parameter expansion". It may help you getting
rid of your "sed" calls...
Examples:
parameter="bash manpage"
${#parameters} - return length of the parameter value.
EX.: ${#parameter} = 12
${parameter#word} - cut shortest match from start of parameter.
EX.: ${parameter#*n} = uensis
${parameter##word} - cut longest match from start of parameter.
EX.: ${parameter#*n} = page
${parameter%word} - cut shortest match from end of parameter.
EX.: ${parameter%n*} = sh manpage
${parameter%%word} - cut longest match from end of parameter.
EX.: ${parameter%%n*} = bash ma
${parameter:offset} - return parameter starting at 'offset'.
EX.: ${parameter:5} = manpage
${parameter:offset:length} - return 'length' characters of parameter
starting at 'offset'.
EX.: ${parameter:4:8} = manpage
${parameter/pattern/string} - replace single match.
EX.: ${parameter/manpage/infosheet} = bash infosheet
${parameter//pattern/string} - replace all matches.
EX.: ${parameter//a/A} = bAsh mAnpAge
Link:
http://www.cups.org/str.php?L2193
Version: -feature
Thread at a glance:
Previous Message by Date:
click to view message preview
Re: Which is the correct way to specify collate
Anders Blomdell wrote:
> With cups 1.2.7 (on fedora6 at least), top level collate has stopped
> working from kprinter and gtklp on printers that support collate. The
> reason is that the collate option exists in both the ppd file and in
> the cups interface, so my question is simply, should collate be
> specified with:
> ...
For printing jobs, use cupsAddOption. ppdMarkOption() only marks the
option in the PPD file/data, which doesn't get applied to the job
unless you actually save your changes to the PPD file in
/etc/cups/ppd.
FWIW, the collate option isn't case sensitive.
--
______________________________________________________________________
Michael Sweet, Easy Software Products mike at easysw dot com
Internet Printing and Document Software http://www.easysw.com
Next Message by Date:
click to view message preview
Re: [RFE] STR #2193: A bash library for parsing template files
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
FWIW, it would be most useful to make sure that this library only uses
POSIX shell functionality and POSIX commands/options. A bash-specific
solution will prevent most commercial UNIX users from making use of the
code...
Link: http://www.cups.org/str.php?L2193
Version: -feature
Previous Message by Thread:
click to view message preview
[RFE] STR #2193: A bash library for parsing template files
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
In my efforts to extend the functionality of the CUPS WEB interface, I
created a BASH library script that parses tmpl files evaluating variables
and arrays and outputs the result.
It is meant to facilitate writing BASH CGIs.
If you find it useful you may do with it as you see fit.
Regards,
Opher Shachar.
Link: http://www.cups.org/str.php?L2193
Version: -feature
tmpl.bash
Description: Binary data
_______________________________________________
cups-dev mailing list
cups-dev-B9D8k9nSxTHQT0dZR+AlfA@xxxxxxxxxxxxxxxx
http://lists.easysw.com/mailman/listinfo/cups-dev
Next Message by Thread:
click to view message preview
Re: [RFE] STR #2193: A bash library for parsing template files
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
FWIW, it would be most useful to make sure that this library only uses
POSIX shell functionality and POSIX commands/options. A bash-specific
solution will prevent most commercial UNIX users from making use of the
code...
Link: http://www.cups.org/str.php?L2193
Version: -feature