TylerRick
asked on
How can I start and immediately background 2 scripts (script1 & ; script2 &)?
I want to do this:
./script/server & ; tail -f log/development.log &
But I get this:
-bash: syntax error near unexpected token `;'
Is there a solution and what is it?
I tried this:
(./script/server &); tail -f log/development.log
which doesn't give a syntax error, but it's not a solution, because the resulting processes don't show up in `jobs`.
./script/server & ; tail -f log/development.log &
But I get this:
-bash: syntax error near unexpected token `;'
Is there a solution and what is it?
I tried this:
(./script/server &); tail -f log/development.log
which doesn't give a syntax error, but it's not a solution, because the resulting processes don't show up in `jobs`.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
TylerRick , please, just ignore my previous post
nedvis
nedvis
./script/server & tail -f log/development.log &
making sure that you can spell tail ;)
( (()
(`-' _\
'' ''
making sure that you can spell tail ;)
( (()
(`-' _\
'' ''
> omit the ";" ..
dooh, another reason to bash bash
:() { :; };:
dooh, another reason to bash bash
:() { :; };:
no, not obfuscated, sophisticated bashing :-))
try yourself in a script, but have the kill button handy ...
sorry for being off-topic
try yourself in a script, but have the kill button handy ...
sorry for being off-topic
ASKER
Thanks for your help, everyone!
Yeah, I don't know why bash has to be so weird. I just assumed that you could separate commands with ; ...
ahoffmann, what shell do you use, if I might ask?
Yeah, I don't know why bash has to be so weird. I just assumed that you could separate commands with ; ...
ahoffmann, what shell do you use, if I might ask?
plain old (Bourne) sh for programming 'cause it's up/downward compatible ;-)
KISS - keep it simple stupid
csh, tcsh interactive; zsh sometimes; tclsh if I want lists; bash if all the others are missing (not too bad:)
Some other pros and cons:
- bash and tcsh can be compiled with special default settings. It's most likely not done, but if, then you may spend a long time to debug some strange behaviours (in particular about reading/executing their resource files at various startups)
- unfortunatelly some vendors hide the original csh and deliver their own buggy one as csh (HP could be named to blame here)-:
- ksh is a nightmare, both in programming and using interactive 'cause you often have to check the version to know how to use some features/bugs; then there is pdksh (installed as ksh) which has not all functionality of original ksh
- bash is strange when it comes to redirect streams
- with csh it is strange, or even impossible, to handle sevaral streams
+ csh is intuitive to redirect STDOUT together with STDERR in any situation
+ bash and csh have an intuitive and easy to use "jobs" functionality
+ sh is the same on all systems (just some ancient Linux are strange)
+ ksh interactive is for people adicted to emacs ;-)
and finally bash is for bashers (fill in whatever reason, pro or con, you like:-)
STFW and you'll find some sites about pros&cons for each. Mainly csh is blaimed for programming 'cause some behaviours are not realy logical.
These are personal preferences, of course.
KISS - keep it simple stupid
csh, tcsh interactive; zsh sometimes; tclsh if I want lists; bash if all the others are missing (not too bad:)
Some other pros and cons:
- bash and tcsh can be compiled with special default settings. It's most likely not done, but if, then you may spend a long time to debug some strange behaviours (in particular about reading/executing their resource files at various startups)
- unfortunatelly some vendors hide the original csh and deliver their own buggy one as csh (HP could be named to blame here)-:
- ksh is a nightmare, both in programming and using interactive 'cause you often have to check the version to know how to use some features/bugs; then there is pdksh (installed as ksh) which has not all functionality of original ksh
- bash is strange when it comes to redirect streams
- with csh it is strange, or even impossible, to handle sevaral streams
+ csh is intuitive to redirect STDOUT together with STDERR in any situation
+ bash and csh have an intuitive and easy to use "jobs" functionality
+ sh is the same on all systems (just some ancient Linux are strange)
+ ksh interactive is for people adicted to emacs ;-)
and finally bash is for bashers (fill in whatever reason, pro or con, you like:-)
STFW and you'll find some sites about pros&cons for each. Mainly csh is blaimed for programming 'cause some behaviours are not realy logical.
These are personal preferences, of course.
IMHO - Stick with sh (bash), unless you have a good reason to use one of the others. Of course it's a matter of preference, but as I work on loads of different systems, commonality between distributions is the most important attribute to me:)
( (()
(`-' _\
'' ''
( (()
(`-' _\
'' ''
pjedmond, that's what I said with more words (which is unusal for me;-)
nedvis