1

I want to write an sh file that will set classpath in Linux.

I tried using:

export ClASSPATH=$CLASSPATH:$ABC_HOME

However, when I run the .sh file it doesn't set the classpath.

2 Answers 2

1

Executing the bash script only sets the environment for the child process. The "source" command may do what you want...

https://askubuntu.com/questions/53177/bash-script-to-set-environment-variables-not-working

Sign up to request clarification or add additional context in comments.

Comments

0

You should make it a shell function, or source it. Because the environment variables are local to the shell (the one started by invoking your shell script).

Please read the advanced bash scripting guide. See also this answer to a similar question.

1 Comment

actually i need to deliver sh file as part of project deliverable , don't know much about shell function

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.