- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: command to repeat last entered command indefin...
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
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
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
тАО08-08-2004 09:12 PM
тАО08-08-2004 09:12 PM
Thanks in advance!
E.g, I enter "ls -l /mydirectory" to check if a file has been newly created. The command will continously loop the "ls -l /mydirectory" command that I issued.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-08-2004 09:15 PM
тАО08-08-2004 09:15 PM
Re: command to repeat last entered command indefinitely
I would use a shell loop
while true
do
ls -l /directory
sleep1
done
Regards
Rainer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-08-2004 09:16 PM
тАО08-08-2004 09:16 PM
Re: command to repeat last entered command indefinitely
ls -l /mydirectory
sleep 5
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-08-2004 09:23 PM
тАО08-08-2004 09:23 PM
Re: command to repeat last entered command indefinitely
until false
do
command
sleep 1
done
Use Crtl+C to abort this endless loop.
sks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-08-2004 09:25 PM
тАО08-08-2004 09:25 PM
Re: command to repeat last entered command indefinitely
Thanks anyway.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-09-2004 11:22 AM
тАО08-09-2004 11:22 AM
Re: command to repeat last entered command indefinitely
In truth however, I can't see any good reason for such a thing to exist.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-09-2004 11:41 AM
тАО08-09-2004 11:41 AM
Re: command to repeat last entered command indefinitely
I have never heard of such thing in HP-UX.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-09-2004 02:22 PM
тАО08-09-2004 02:22 PM
Re: command to repeat last entered command indefinitely
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-09-2004 03:04 PM
тАО08-09-2004 03:04 PM
Re: command to repeat last entered command indefinitely
In any case, some of the documentation distributed with Watch is as follows:
WATCH
A little program similar to another called 'vis' which simply re-displays in a polling fashion the output of other programs. "watch ps --sort:utime" might be dubbed a poor man's 'top'. Though this has been included in procps for some time it hasn't been built or installed by default. It is now.
All that being said, 'vis' on HP-UX does nothing like this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-09-2004 04:48 PM
тАО08-09-2004 04:48 PM
Re: command to repeat last entered command indefinitely
Make a small script on the lines of above posts say watch. Give it +x permission and put in /usr/local/bin.
until false
do
#echo $1
$1
sleep 1
done
So with this you can give commands such as:
watch ls
or
watch "ls -l"
sks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-09-2004 05:02 PM
тАО08-09-2004 05:02 PM
Re: command to repeat last entered command indefinitely
myscript:
#!/bin/sh
while true
do
$1
done
when you do a $myscript "ps -ef|grep XXX", it doesn't give the correct output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-09-2004 05:50 PM
тАО08-09-2004 05:50 PM
Re: command to repeat last entered command indefinitely
until false
do
case $# in
1)
$1
sleep 1
;;
2)
$1 | $2
sleep 1
;;
*) echo "Invalid..."
esac
done
Give the command as below (Don't use the pipe):
$myscript "ps -ef" "grep XXX"
sks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-09-2004 07:44 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-09-2004 08:05 PM
тАО08-09-2004 08:05 PM