Ask a Question related to Linux / Unix Administration, Design and Development.
-
guerrilla_thought #1
Execute all processes in the background from bash.
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
guerrilla_thought Guest
-
problem using bash variables with command-line perl in bash script
Hi! I have a problem with variables when using command-line perl in a bash script. The script should update a date (in 2003-10-10 form) if the... -
running background (daemon) processes in Windows
In Unix I can start a 'deamon' (background) process like: ruby -e 'fork do system("something") end' Or by putting the fork directly into my... -
Background processes inside the database.
I am looking for a way to have a session spawn a background process and release. The user needs to be able to start a job which could conceivably... -
How to execute perl from bash
Hi everyone! I need to trip blank spaces at begin and end on certain string. I can do it executing perl -e '$str = " 2003-07-29 "; $str =~... -
Oracle background processes
gotta_know wrote: Not if you go through the trouble to make it work. Though anything you have written that deals with file permissions, etc.... -
Alan Connor #2
Re: Execute all processes in the background from bash.
On Wed, 19 May 2004 08:33:06 GMT, guerrilla_thought <guerrilla_thought@gmx.de> wrote:
One way would be to use the PROMPT_COMMAND Bash variable to run a function>
>
> 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
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:
[url]http://tinyurl.com/2t5kp[/url] || [url]http://tinyurl.com/3c3ag[/url]
Challenge-Response links -- [url]http://tinyurl.com/yrfjb[/url]
Alan Connor Guest
-
Timo Felbinger #3
Re: Execute all processes in the background from bash.
On Wed, 19 May 2004, guerrilla_thought wrote:
If your bash is using GNU-readline for obtaining user input (it probably> 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.
>
does), then you could add something similar to the following into your
~/.inputrc:
'\C-a': beginning-of-line
'\C-e': end-of-line
'\C-n': accept-line
'\C-m': "\C-a time \C-e &\C-n"
See the readline man page for more details.
Regards,
Timo Felbinger
--
Timo Felbinger <Timo.Felbinger@physik.uni-potsdam.de>
Quantum Physics Group [url]http://www.quantum.physik.uni-potsdam.de[/url]
Institut fuer Physik Tel: +49 331 977 1793 Fax: -1767
Universitaet Potsdam, Germany
Timo Felbinger Guest
-
Doug Freyburger #4
Re: Execute all processes in the background from bash.
guerrilla_thought wrote:
All/every? I use ls, cd and so on often enough that would be a>
> 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.
disaster for me.
When I intend to run a command very often, I write a small script
and name it "x" somewhere in my path. It would be something like:
#! /bin/bash
time ${1} &
exit
Then I would type most of my commands normally and "x mozilla".
Since you mentioned mozilla, you probably want to use "nohup" rather
than "time".
Doug Freyburger Guest
-
Ed Morton #5
Re: Execute all processes in the background from bash.
Doug Freyburger wrote:
<snip>You might want to make the above:> All/every? I use ls, cd and so on often enough that would be a
> disaster for me.
>
> When I intend to run a command very often, I write a small script
> and name it "x" somewhere in my path. It would be something like:
>
> #! /bin/bash
> time ${1} &
time "$@" &
so you capture arguments.
No need for the exit.> exit
Ed.>
> Then I would type most of my commands normally and "x mozilla".
> Since you mentioned mozilla, you probably want to use "nohup" rather
> than "time".Ed Morton Guest
-
Doug Freyburger #6
Re: Execute all processes in the background from bash.
Ed Morton wrote:
Good point.> Doug Freyburger wrote:
>>> > When I intend to run a command very often, I write a small script
> > and name it "x" somewhere in my path. It would be something like:>> > #! /bin/bash
> > time ${1} &
> You might want to make the above:
> time "$@" &
> so you capture arguments.
True but there isn't necessarily need for the magic number in the first>> > exit
> No need for the exit.
line, either. I put them into all of my scripts for cleanliness reasons.
Doug Freyburger Guest
-
Kevin Collins #7
Re: Execute all processes in the background from bash.
In article <7960d3ee.0405200757.2b49b50f@posting.google.com >, Doug Freyburger
wrote:I assume you mean the "shebang" entry (#!/bin/bash)? If so, there is a need for> Ed Morton wrote:>>> Doug Freyburger wrote:
>>>>>> > When I intend to run a command very often, I write a small script
>> > and name it "x" somewhere in my path. It would be something like:>>>> > #! /bin/bash
>> > time ${1} &
>> You might want to make the above:
>> time "$@" &
>> so you capture arguments.
> Good point.
>>>>>> > exit
>> No need for the exit.
> True but there isn't necessarily need for the magic number in the first
> line, either. I put them into all of my scripts for cleanliness reasons.
it, unless you want all your scripts to run as /bin/sh, which you probably
don't. :)
Kevin
Kevin Collins Guest



Reply With Quote

