public inbox for linux-newbie@vger.kernel.org
 help / color / mirror / Atom feed
From: AD Marshall <admarshall@gmail.com>
To: John Kelly <bilbo@waitrose.com>
Cc: linux-newbie@vger.kernel.org
Subject: Re: how-to: one command for repeat OR iterate shell OR bash command delay OR interval
Date: Sun, 17 Jul 2005 13:16:10 +0700	[thread overview]
Message-ID: <200507171316.10728.admarshall@gmail.com> (raw)
In-Reply-To: <200507171307.46798.admarshall@gmail.com>

my apologies, if necessary.  but it's way past lunchtime in saigon and
i'm STARVING.  i'll check back later.  thanx again. - best, andi

On Sunday 17 July 2005 13:07, AD Marshall wrote:
> On Sunday 17 July 2005 12:35, John Kelly wrote:
> > Hi,
> > On Sun, 17 Jul 2005 11:57:34 +0700
> > AD Marshall <admarshall@gmail.com> wrote:
> > 
> > > Is there already one bash command to do what the following script
> > > does (poorly or incompletely), ie repeat "command" indefinitely
> > > every "x" seconds:
> > > 
> > > #!/bin/sh
> > > # usage: repeat [x] <command>
> > > while true ; do $2 ; sleep $1 ; done
> > > 
> > > < rest deleted > 
> > 
> > The watch command might tbe what you want.
> > Or maybe not, if you don't want anything output to screen.
> >  
> > Try man watch for details.
> > 
> <cut>
> Ya.  Thanks.  I'd (long) forgotten about "watch".  
> 
> but, actually, i should be more specific. what i'm trying to do is 
> something like this -- though i'm screwing up on quoting or something
> 
> am@[~]$ repeat 2 "echo $(cat /proc/loadavg ; date +%H:%m:%S)"
> 0.05 0.14 0.24 6/127 27711 12:07:29
> 0.05 0.14 0.24 6/127 27711 12:07:29
> 0.05 0.14 0.24 6/127 27711 12:07:29
> 
> as you can see, only one instance of load average and time are repeated.
> i want a running record that can be redirected to a file
> 
> i just tinkered with backslashes, back-quotes, double-quotes and 
> single-quotes, but all the quoting stuff still confuses me.
> 
> and, imho, i would have thought someone would have written a simple 
> tool to do this ages ago.  no?
> 
> thanx again,
> andi
> 

-- 
AD Marshall
Tel:  +84 (0)903871313
eM:   admarshall@gmail.com
Web:  http://h0lug.sourceforge.net
Zone: ICT (IndoChina Time; GMT/UTC+7)
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

  reply	other threads:[~2005-07-17  6:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-17  4:57 how-to: one command for repeat OR iterate shell OR bash command delay OR interval AD Marshall
2005-07-17  5:35 ` John Kelly
2005-07-17  6:07   ` AD Marshall
2005-07-17  6:16     ` AD Marshall [this message]
2005-07-19  3:24       ` [Solution] " AD Marshall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200507171316.10728.admarshall@gmail.com \
    --to=admarshall@gmail.com \
    --cc=bilbo@waitrose.com \
    --cc=linux-newbie@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox