Ok I wanna conditionally execute a command in the background from my shell script. Here is what I'm trying to doBACKGROUND=""if [ "$OSTYPE" = "linux" ] ; then BACKGROUND="&"fi exec "$JAVA_HOME/bin/java" <all my shit> $BACKGROUNDI would expect if my OSTYPE did equal linux that this command would run in the background, but it does not. If i hardcode '&' after my java call however, it will run in the background. What am i doing wrong???
4/23/2007 10:44:27 AM
What shell are you using?Throw in some echo command to check that your variables are being set and to check the results of your if then statements. That should help with troublshooting.Just out of curiosity, what exactly are you doing where the OS type is something that is variable?
4/23/2007 10:56:20 AM
its gettin set right. ive already thrown in echo's to verify.[q]Just out of curiosity, what exactly are you doing where the OS type is something that is variable?[/q]not quite sure what ur asking... the OSTYPE is an env variable. its set by a program that ends up calling this shell script.
4/23/2007 10:58:35 AM
ok I got the same functionality but not really what I want.im just calling the entire script with '&' - so from c im doing execShell("myscript.sh &"); My problem is solved but if anyone knows the answer to my question it would be cool to know what I am missing...
4/23/2007 11:25:13 AM
on my machine OSTYPE is set to linux-gnu. Check what echo $OSTYPE shows.
4/23/2007 12:30:15 PM