Re: Auto repeat of a command

From: Alexis Huxley (alexis_at_dione.no-ip.org)
Date: 07/30/03


Date: Wed, 30 Jul 2003 16:46:34 +0200


> example: rep ls 15
>
> My script works for simple commands like: ls or bdf. But when I enter
> more complex commands (~ie. ps -ef | grep master) it picks up the
> command until the first space.

Supply the argument of fixed "word width" first; i.e. the
repetition count which is always one word long:

        rep 15 ls

Then 'shift' off this one word with something like:

        COUNT=$1
        shift

And the what you want will be left in "$@" (with the quotes):

        CMD="$@"

-- 
Alexis
http://dione.no-ip.org/~alexis/


Relevant Pages

  • [opensuse] some sed-help, please
    ... I used sed 's/^ /\t/' txtfile, but I do not get a tab. ... do more then just the first space, ... To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx ... For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx ...
    (SuSE)
  • Re: [opensuse] some sed-help, please
    ... I used sed 's/^ /\t/' txtfile, but I do not get a tab. ... do more then just the first space, ... To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx ... For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx ...
    (SuSE)
  • =?ISO-8859-1?Q?New_System_Command_Script_Facility?=
    ... I'm currently finished writing a new replacement command script processor ... (at least that RACF thinks so, and better support for non-RACF sites). ... The IF-type commands now have ELSE processing ... non-scroll highlighted console message and BEEP until a specific JOB or TASK ...
    (bit.listserv.ibm-main)
  • Re: Command Line Interface
    ... >> should accept system commands only for an administrator. ... >> how should I supress the bash shell and launch my custom CLI ... > The script could run in a restricted shell and offer a menu of ... account, and either 1) change account password, 2) ...
    (comp.os.linux.misc)
  • Net::Telnet and SMTP
    ... I'm trying to send a sequence of commands and then log both the ... I've included the script and a sample text file (that feeds the scripts ... sub processfile { ... #Try a short delay between sending command and reading output ...
    (comp.lang.perl.misc)