Re: Execute all processes in the background from bash.

From: Alan Connor (zzzzzz_at_xxx.yyy)
Date: 05/19/04


Date: Wed, 19 May 2004 09:31:38 GMT

On Wed, 19 May 2004 08:33:06 GMT, guerrilla_thought <guerrilla_thought@gmx.de> wrote:
>
>
> I was wondering if it's possible to prepend "time" and append "&" to all
> commands that I execute in bash. For example I'd like
> $ mozilla
> to exapand to
> $ time mozilla &
> to time it and execute it in the background. Anyone know if this is
> possible using bash, maybe with environment variables? It's quite
> inconvenient to type time before and & after every command that I execute.
> Thank you.
>
> * Anthony

One way would be to use the PROMPT_COMMAND Bash variable to run a function
just before the prompt came up:

function_name () {

read PC

time "${PC}" &

}

Doesn't really run in the background, though, and I can't make common
commands run in the background at all. Try ls & ...

Of course, that function takes away your prompt, so you need to
include one in the function...

Hang around. There are probably better ideas coming along...

AC

-- 
Pass-List -----> Block-List ----> Challenge-Response
The key to taking control of your mailbox.  Design Parameters:
http://tinyurl.com/2t5kp ||   http://tinyurl.com/3c3ag
Challenge-Response links -- http://tinyurl.com/yrfjb


Relevant Pages

  • Re: Execute all processes in the background from bash.
    ... > commands that I execute in bash. ... > to time it and execute it in the background. ... commands run in the background at all. ... Of course, that function takes away your prompt, so you need to ...
    (comp.unix.admin)
  • Re: why wont my awk if/else work for both conditions?
    ... output1.txt; then echo y; else echo n; fi ... bash - but then stops. ... commands executed while in sh. ... but only when i type it directly into the prompt - not ...
    (comp.unix.shell)
  • Re: Execute all processes in the background from bash.
    ... > commands that I execute in bash. ... > to time it and execute it in the background. ... > inconvenient to type time before and & after every command that I execute. ...
    (comp.unix.admin)
  • Re: Execute all processes in the background from bash.
    ... > commands that I execute in bash. ... > to time it and execute it in the background. ... > inconvenient to type time before and & after every command that I execute. ...
    (comp.unix.questions)
  • Re: Newb request: scripts
    ... > not hard to learn bash, but i'm new and i gave up. ... Your prompt can be set quite easily. ... Start with the basic commands. ... have started writing shellscripts without noticing. ...
    (comp.unix.shell)