Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Background processes in ksh blocks

Status
Not open for further replies.

columb

IS-IT--Management
Feb 5, 2004
1,231
EU
We have some code which looks like
Code:
[[ condition ]] && { command1; command2; }
so far, so good. However we now want run 'command1' in the background so we changed the code to
Code:
[[ condition ]] && { command1 &; command2; }
Now we get the error message
Code:
ksh: 0403-057 Syntax error: `}' is not expected.
Ok, so I could use the if-then-fi format but I'm interested to know what's going on and how I can stop it.

Thanks

Ceci n'est pas une signature
Columb Healy
 
And what about this ?
[[ condition ]] && {
command1 &
command2
}

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Just leave out the semicolon after the ampersand.
You shouldn't need a newline after the ampersand.

[[ condition ]] && { command1 & command2 }


HTH,

p5wizard
 
Thanks PHV - that works a treat, and tidies up my scripts which were stretching well over the 80 char mark

Ceci n'est pas une signature
Columb Healy
 
And another thanks to p5wizard

Ceci n'est pas une signature
Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top