The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help with the 2 for loops vadharah Shell Programming and Scripting 1 03-04-2008 01:26 PM
Help with While Loops MaestroRage UNIX for Dummies Questions & Answers 1 02-12-2008 11:04 PM
while loops nymus7 Shell Programming and Scripting 4 03-31-2006 09:59 AM
While loops and awk Loriel Shell Programming and Scripting 1 10-26-2005 09:26 AM
no more loops tony3101 Shell Programming and Scripting 5 06-09-2004 11:01 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-21-2005
Registered User
 

Join Date: Feb 2005
Posts: 137
ksh question, loops

i want to add about 60 printers using a ksh script.
i am having trouble though, i am reading the input from the hosts file and using the lpadmin command to add like so:

lpadmin -p [printername] -v /dev/null -m netstandard -o dest=[ipaddy]

i want printername and ipaddy to come from the hosts file, i am having some trouble getting the right variables in the right spots, i know this is about a 2 minute script for some of you, so any assistance will be greatly appreciated.


thanks,
Brian
Reply With Quote
Forum Sponsor
  #2  
Old 06-21-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
assuming /etc/host file format:
Code:
#!/bin/ksh
while read ip host junk
do
   lpadmin -p "${host}" -v /dev/null -m netstandard -o dest="${ip}"
done < myPrinterFile
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:07 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0