Solved

How can I start and immediately background 2 scripts (script1 & ; script2 &)?

Posted on 2006-06-29
11
439 Views
Last Modified: 2008-02-07
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`.
0
Comment
Question by:TylerRick
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 20

Expert Comment

by:nedvis
ID: 17012217
try changin semicolon (  :   )   to   pipe character (  |  )

nedvis
 
0
 
LVL 15

Accepted Solution

by:
DonConsolio earned 125 total points
ID: 17012306
omit the ";" - the "&" should be enough to terminate the command

use this:
./script/server & ttail -f log/development.log &
0
 
LVL 20

Expert Comment

by:nedvis
ID: 17012325
TylerRick , please,  just ignore my previous post

nedvis
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:pjedmond
ID: 17012408
./script/server & tail -f log/development.log &

making sure that you can spell tail ;)

(   (()
(`-' _\
 ''  ''
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17012972
> omit the ";"  ..
dooh, another reason to bash bash
:() { :; };:
0
 
LVL 22

Expert Comment

by:pjedmond
ID: 17013034
:() { :; };:

Is this an obfuscated bash coding competition?

http://www.de.ioccc.org/main.html
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17013192
no, not obfuscated, sophisticated bashing :-))
try yourself in a script, but have the kill button handy ...

sorry for being off-topic
0
 

Author Comment

by:TylerRick
ID: 17013906
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17015875
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
 
LVL 22

Expert Comment

by:pjedmond
ID: 17016336
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17016366
pjedmond, that's what I said with more words (which is unusal for me;-)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question