![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| bash - add backslash in front of variables w/ spaces | trey85stang | Shell Programming and Scripting | 3 | 11-05-2008 05:32 AM |
| Read variables contain spaces from text file | ahmed.zaher | Shell Programming and Scripting | 1 | 10-20-2008 07:44 PM |
| Assigning 'KSH' variables containing muliple spaces | stv_t | Shell Programming and Scripting | 2 | 07-22-2008 04:59 AM |
| removing spaces from variables? | yongho | UNIX for Dummies Questions & Answers | 2 | 06-10-2005 05:03 PM |
| lpadmin help | andrec | UNIX for Dummies Questions & Answers | 2 | 09-13-2001 02:51 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I apologize for the long post. I have a lot of info...
I am trying to write a script that will add a network printer (or several) to a system using information read in from a text file. My problem is the spaces in the PPD file name, I'm not sure how to put the file name in or how to read it back so the spaces are read properly. So, If I type this command: lpadmin -p MyOfficePrinter -E -v lpd://my.server.ca/Office -P /Library/Printers/PPDs/Contents/Resources/en.lproj/HP\ LaserJet\ 4000\ Series.gz It works fine. But of course I might want to name the printer something else, or use a different queue, or change the printer type. My first attempt at using variables was: PrintName="MyOfficePrinter" PrinterQ="lpd://my.server.ca/Office" PPDfile="/Library/Printers/PPDs/Contents/Resources/en.lproj/HP\ LaserJet\ 4000\ Series.gz" lpadmin -p $PrinterName -E -v $PrinterQ -P $PPDfile This would install the printer as a local printer and give an error: lpadmin: add-printer (set model) faild: client-error-not-found After running 'set -x' I was able to see that bash was expanding the command to: + lpadmin -p MyOfficePrinter -E -v lpd://my.server.ca/Office -P 'Library/Printers/PPDs/Contents/Resources/en.lproj/HP\' 'LaserJet\' '4000\' Series.gz After this I tried a whole bunch of test variables and found (of course) that having backslash's in the variable was messing me up. I tried a few different ways of putting this command together and the closest I got was: PrintName="MyOfficePrinter" PrinterQ="lpd://my.server.ca/Office" PPDfile="/Library/Printers/PPDs/Contents/Resources/en.lproj/HP LaserJet 4000 Series.gz" lpadmin -p $PrinterName -E -v $PrinterQ -P "$PPDfile" Which expands to: lpadmin -p MyOfficePrinter -E -v lpd://my.server.ca/Office -P '/Library/Printers/PPDs/Contents/Resources/en.lproj/HP\ LaserJet\ 4000\ Series.gz' Which runs, does not generate an error, and the printer shows up in my printer list in System Preferences. But it does not print and does not have anything listed in it's installable options. So it partially installed the printer. Other than going through my en.lproj folder and removing the spaces from all the file names, I can't think of anything else to do to make this work. Can anyone out there help???? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|