Reputation: 1725
I have to convert the following .bat code in the .sh code
echo Setting Bonita Environment variable
set "JAVA_OPTS=%JAVA_OPTS% -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory"
set "JAVA_OPTS=%JAVA_OPTS% -Djava.naming.provider.url=jnp://localhost:1099"
set "LOG_OPTS= -Djava.util.logging.config.file=D:\jboss-5.0.0.CR2-jdk6\jboss-5.0.0.CR2\server\default\conf\logging.properties"
set "SECURITY_OPTS= -Djava.security.auth.login.config=D:\jboss-5.0.0.CR2-jdk6\jboss-5.0.0.CR2\server\default\conf\jaas-standard.cfg"
set JAVA_OPTS= %JAVA_OPTS% %LOG_OPTS% %SECURITY_OPTS%
echo %JAVA_OPTS%
Please guide me to do that. Thanks.
Upvotes: 0
Views: 3403
Reputation: 342293
echo Setting Bonita Environment variable
JAVA_OPTS="$JAVA_OPTS -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory"
JAVA_OPTS="$JAVA_OPTS -Djava.naming.provider.url=jnp://localhost:1099"
LOG_OPTS="-Djava.util.logging.config.file=D:\jboss-5.0.0.CR2-jdk6\jboss-5.0.0.CR2\server\default\conf\logging.properties"
SECURITY_OPTS="-Djava.security.auth.login.config=D:\jboss-5.0.0.CR2-jdk6\jboss-5.0.0.CR2\server\default\conf\jaas-standard.cfg"
JAVA_OPTS="${JAVA_OPTS}${LOG_OPTS}${SECURITY_OPTS}"
echo "$JAVA_OPTS"
Upvotes: 1
Reputation: 881123
It's a fairly simple conversion job:
%xyz%
should be replaced with ${xyz}
.set
statements should be export
.set "abc=xyz"
type statements should be export abc="xyz"
(different position for quotes).source
it or .
it, not run it. Running it will create those variable in a sub-shell, not your desired shell.Upvotes: 0