Proper way to setup environment variables
by shogun1234 from LinuxQuestions.org on (#4TQHY)
In command line, I understand I can export environment variable by export. For instance,
Code:$ export JAVA_OPTS="..."
$ java -cp ./ $JAVA_OPTS ...But sometimes I seems to see some usage such
Code:env JAVA_OPTS="..."; java -cp ... $JAVA_OPTSor
Code:JAVA_OPTS="..."; java -cp ... $JAVA_OPTSI can't remember the exact way those commands to export environment variables (so I believe the syntax I use could be wrong). Thus I am interested to learn what's a more appropriate way to export environment variables or (if it's just different syntax as unix allows different approach the goal by different ways) the differences between those syntax.
Thanks


Code:$ export JAVA_OPTS="..."
$ java -cp ./ $JAVA_OPTS ...But sometimes I seems to see some usage such
Code:env JAVA_OPTS="..."; java -cp ... $JAVA_OPTSor
Code:JAVA_OPTS="..."; java -cp ... $JAVA_OPTSI can't remember the exact way those commands to export environment variables (so I believe the syntax I use could be wrong). Thus I am interested to learn what's a more appropriate way to export environment variables or (if it's just different syntax as unix allows different approach the goal by different ways) the differences between those syntax.
Thanks