- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- while true loop
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2002 08:14 PM
10-02-2002 08:14 PM
I've written the following script to cancel a printer jobs queue but the script keeps prompting asking for an input again:
while true
do
echo "enter printer name ?\c"
read ANSW
cancel -e $ANSW
done
appreciate you advise and support..
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2002 08:19 PM
10-02-2002 08:19 PM
Re: while true loop
To get out of that loop you'll have to do a CTRL-C
What exactly do you want the script to do? Do you want it to execute once? Do you want it to prompt the user before it executes again?
We need more info before we can effectively help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2002 08:33 PM
10-02-2002 08:33 PM
Re: while true loop
The read statement is inside the while loop and hence as long as the while loop is true, it will prompt you for the input. Take the read statement out of the while loop.
BTW, what exactly are you trying. If you just need to cancel the jobs of a specific printer, just take away the loop and execute the rest of the commands.
Regards
Balajio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2002 08:34 PM
10-02-2002 08:34 PM
Re: while true loop
The read statement is inside the while loop and hence as long as the while loop is true, it will prompt you for the input. Take the read statement out of the while loop.
BTW, what exactly are you trying. If you just need to cancel the jobs of a specific printer, just take away the loop and execute the rest of the commands.
Regards
Balaji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2002 08:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2002 08:46 PM
10-02-2002 08:46 PM
Re: while true loop
for printername in $(lpstat|grep \^printer|awk '{print $4}')
do
cancel -e $printername
done
This command extract all the printername configured in your system.
$ lpstat|grep \^printer|awk '{print $4}'
Not sure if this is what you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2002 12:26 AM
10-03-2002 12:26 AM
Re: while true loop
I realy appreciate your prompt reply. However, I was not sure if I removed the loop
the script will cancel the whole bunch of a specific printer jobs. I'll try and see what happens?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2002 01:19 AM
10-03-2002 01:19 AM
Re: while true loop
From the man pages of cancel.
-e Empty the spool queue of all requests for each printer.
Only users with appropriate privileges can use this
option.
So, if ur root and run cancel -e
HTH
-balaji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2005 04:57 AM
02-24-2005 04:57 AM