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`.
TylerRickAsked:
Who is Participating?
 
DonConsolioCommented:
omit the ";" - the "&" should be enough to terminate the command

use this:
./script/server & ttail -f log/development.log &
0
 
nedvisCommented:
try changin semicolon (  :   )   to   pipe character (  |  )

nedvis
 
0
 
nedvisCommented:
TylerRick , please,  just ignore my previous post

nedvis
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
pjedmondCommented:
./script/server & tail -f log/development.log &

making sure that you can spell tail ;)

(   (()
(`-' _\
 ''  ''
0
 
ahoffmannCommented:
> omit the ";"  ..
dooh, another reason to bash bash
:() { :; };:
0
 
pjedmondCommented:
:() { :; };:

Is this an obfuscated bash coding competition?

http://www.de.ioccc.org/main.html
0
 
ahoffmannCommented:
no, not obfuscated, sophisticated bashing :-))
try yourself in a script, but have the kill button handy ...

sorry for being off-topic
0
 
TylerRickAuthor Commented:
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?
0
 
ahoffmannCommented:
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.
0
 
pjedmondCommented:
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:)

(   (()
(`-' _\
 ''  ''

0
 
ahoffmannCommented:
pjedmond, that's what I said with more words (which is unusal for me;-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.