Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Help with script to automate CUPS printer installs Post 302749087 by aperfecthalo on Thursday 27th of December 2012 12:45:11 PM
Old 12-27-2012
Hi RudiC,

Thanks for the speedy response. I'll go through my code and amend the unterminated if/elif statments first - am I correct in thinking I'll simply need to add the second fi in after the last elif? Eg:

Code:
if [ "$option-oki" = "1" ]; then
            read -p "How many paper trays will this printer have? Enter MF/1/2 : " b4350-trays
                if [ "$4350-trays" = "MF" ]; then
                DRV1=$B4350MF
                elif [ "$4350-trays" = "1" ]; then
                DRV1=$B4350MF
                DRV2=$B4350T1
                elif [ "$4350-trays" = "2" ]; then
                DRV1=$B4350MF
                DRV2=$B4350T1
                DRV3=$B4350T2
            fi
    fi

If I'm wrong, apologies. I never thought of using select in all honesty, I (at least thought I) knew the if, so I decided to stick in my comfort zone. If it would make more sense using select, I'll look into that.

What do you mean by an options file? Sorry if I'm a bit slow.

Kind regards.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sharing printer with windows via cups and samba

I want to use my linux box as a print server for my hp printer. I downloaded the linux driver for the printer and installed it. I also configured CUPS and printed a test page with it. Samba is allowing my windows machine to see and install the printer, but when i try to print to it, nothing... (1 Reply)
Discussion started by: Spetnik
1 Replies

2. Linux

Sharing Printer Linux + XP (cups/samba)

I keep getting a access denied error when I install from the XP wizard my Linux shared printer. CUPS CONFIGURATION FILE <Location /admin> # # You definitely will want to limit access to the administration functions. # The default configuration requires a local connection from a user who #... (2 Replies)
Discussion started by: Alux
2 Replies

3. Shell Programming and Scripting

here document to automate perl script that call script

I am trying to use a here document to automate testing a perl script however when the perl script hits a system(perl subscript.pl) call, input is no longer entered into this subscript. here is my script $ cat test.sh #ksh for testcase do program <<-EOF | tee -a funcscnlog.log y... (3 Replies)
Discussion started by: hogger84
3 Replies

4. Linux

mapping of a printer model with a ppd file in CUPS

Hi all, I am currently working on building a GUI to be interfaced with CUPS 1.3.4 package; In my GUI I have a list of printer manufacturers mapped With various printer models ; and for a particular printer model selected I needed to know how to map that model with an Appropriate ppd file; as I... (0 Replies)
Discussion started by: sc3008
0 Replies

5. UNIX for Advanced & Expert Users

Script that can Automate Printer adding task in HP-UX servers

I want to make a script to automate printer adding task.My inputs are like Printer name : xyz Port number :9001 I should write a script to make the Printer adding task will be automated. Like in manually adding task we are doing through hppi or jetadmin tools. ---------- Post updated at... (2 Replies)
Discussion started by: AnilKPatnaik
2 Replies

6. Red Hat

Need a single printer driver added to CUPS

Just got an HP OfficeJet L7680 printer but there are no drivers for it in RHEL5. I just want to add the single driver without installing hplip 3.9.8. It's going to be connected with USB. Is this possible and if so how? (1 Reply)
Discussion started by: deloev
1 Replies

7. SCO

Replace Line Printer Daemon (LPD) with CUPS

hi Howto replace Line Printer Daemon (LPD) with CUPS on SCO 5.0.6? (3 Replies)
Discussion started by: ccc
3 Replies

8. UNIX for Dummies Questions & Answers

Query for printer driver in CUPS

I have a RHEL 4 (probably not important, but whatever) machine with a few dozen network printers set up in CUPS. I would like to replicate this on a second machine. With lpinfo I'm able to get the queue name and device information (socket://ipaddress or whatnot), but I haven't get figured out... (0 Replies)
Discussion started by: kknigga
0 Replies

9. Red Hat

Samba and Cups :: How to Hide Printer Icons

Hi, I am running Linux box with samba-3.0.33 cups-1.3.7 When I access my home folder through windows and give user credentials, it works well but shows all the printers icons as well. I would like to hide them all from users. I tried changing Browsing On to Browsing Off in... (1 Reply)
Discussion started by: amit_spl
1 Replies

10. Solaris

Printer configuration Migration from Solaris 10 "LP" to Solaris 11 "CUPS"

Need to find a way to import an LP printers.conf file to CUPS. I have some new Solaris 11.1 boxes that need to have 300 printers added. (0 Replies)
Discussion started by: os2mac
0 Replies
UNIFDEF(1)						    BSD General Commands Manual 						UNIFDEF(1)

NAME
unifdef, unifdefall -- remove preprocessor conditionals from code SYNOPSIS
unifdef [-cdeklnst] [-Ipath] [-Dsym[=val]] [-Usym] [-iDsym[=val]] [-iUsym] ... [file] unifdefall [-Ipath] ... file DESCRIPTION
The unifdef utility selectively processes conditional cpp(1) directives. It removes from a file both the directives and any additional text that they specify should be removed, while otherwise leaving the file alone. The unifdef utility acts on #if, #ifdef, #ifndef, #elif, #else, and #endif lines, and it understands only the commonly-used subset of the expression syntax for #if and #elif lines. It handles integer values of symbols defined on the command line, the defined() operator applied to symbols defined or undefined on the command line, the operators !, <, >, <=, >=, ==, !=, &&, ||, and parenthesized expressions. Anything that it does not understand is passed through unharmed. It only processes #ifdef and #ifndef directives if the symbol is specified on the command line, otherwise they are also passed through unchanged. By default, it ignores #if and #elif lines with constant expressions, or they may be processed by specifying the -k flag on the command line. The unifdef utility also understands just enough about C to know when one of the directives is inactive because it is inside a comment, or affected by a backslash-continued line. It spots unusually-formatted preprocessor directives and knows when the layout is too odd to handle. A script called unifdefall can be used to remove all conditional cpp(1) directives from a file. It uses unifdef -s and cpp -dM to get lists of all the controlling symbols and their definitions (or lack thereof), then invokes unifdef with appropriate arguments to process the file. Available options: -Dsym[=val] Specify that a symbol is defined, and optionally specify what value to give it for the purpose of handling #if and #elif directives. -Usym Specify that a symbol is undefined. If the same symbol appears in more than one argument, the last occurrence dominates. -c If the -c flag is specified, then the operation of unifdef is complemented, i.e., the lines that would have been removed or blanked are retained and vice versa. -d Turn on printing of degugging messages. -e Because unifdef processes its input one line at a time, it cannot remove preprocessor directives that span more than one line. The most common example of this is a directive with a multi-line comment hanging off its right hand end. By default, if unifdef has to process such a directive, it will complain that the line is too obfuscated. The -e option changes the behaviour so that, where pos- sible, such lines are left unprocessed instead of reporting an error. -k Process #if and #elif lines with constant expressions. By default, sections controlled by such lines are passed through unchanged because they typically start ``#if 0'' and are used as a kind of comment to sketch out future or past development. It would be rude to strip them out, just as it would be for normal comments. -l Replace removed lines with blank lines instead of deleting them. -n Add #line directives to the output following any deleted lines, so that errors produced when compiling the output file correspond to line numbers in the input file. -s Instead of processing the input file as usual, this option causes unifdef to produce a list of symbols that appear in expressions that unifdef understands. It is useful in conjunction with the -dM option of cpp(1) for creating unifdef command lines. -t Disables parsing for C comments and line continuations, which is useful for plain text. -iDsym[=val] -iUsym Ignore #ifdefs. If your C code uses #ifdefs to delimit non-C lines, such as comments or code which is under construction, then you must tell unifdef which symbols are used for that purpose so that it will not try to parse comments and line continuations inside those #ifdefs. One specifies ignored symbols with -iDsym[=val] and -iUsym similar to -Dsym[=val] and -Usym above. -Ipath Specifies to unifdefall an additional place to look for #include files. This option is ignored by unifdef for compatibility with cpp(1) and to simplify the implementation of unifdefall. The unifdef utility copies its output to stdout and will take its input from stdin if no file argument is given. The unifdef utility works nicely with the -Dsym option of diff(1). EXIT STATUS
The unifdef utility exits 0 if the output is an exact copy of the input, 1 if not, and 2 if in trouble. DIAGNOSTICS
Too many levels of nesting. Inappropriate #elif, #else or #endif. Obfuscated preprocessor control line. Premature EOF (with the line number of the most recent unterminated #if). EOF in comment. SEE ALSO
cpp(1), diff(1) HISTORY
The unifdef command appeared in 2.9BSD. ANSI C support was added in FreeBSD 4.7. AUTHORS
This implementation was originally written by Dave Yost <Dave@Yost.com>. Tony Finch <dot@dotat.at> rewrote it to support ANSI C. BUGS
Expression evaluation is very limited. Preprocessor control lines split across more than one physical line (because of comments or backslash-newline) cannot be handled in every situation. Trigraphs are not recognized. There is no support for symbols with different definitions at different points in the source file. The text-mode and ignore functionality does not correspond to modern cpp(1) behaviour. BSD
September 24, 2002 BSD
All times are GMT -4. The time now is 12:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy