Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

The following is an extract of an instruction manual:

If Java is reconfigured after SAV for Linux has already been installed, the JAVA_HOME value in /etc/Symantec.conf must be updated.
This can be done manually, or automatically by running /opt/Symantec/symantec_antivirus/update_java_home.sh

How do I run update_java_home.sh? What specific commands must I issue? What does the file extension .sh mean?

I am new to Linux and Ubuntu and would welcome detailed instructions on how to run update_java_home.sh

share|improve this question
add comment

3 Answers 3

up vote 0 down vote accepted

The file extension .sh means it is a shell script. If you dont know what a shell is you can read about it here. Any shell script file can be executed by typing its path (complete or relative) in shell and pressing enter:

adnan@laptop:~/>/some/path/script_name.sh
adnan@laptop:/some/path/>./script_name.sh

In your case the error is giving you complete path to the file update_java_home.sh. So just open Bash and write the following line

/opt/Symantec/symantec_antivirus/update_java_home.sh
share|improve this answer
    
@ binW: Thanks. What is "complete path"? "relative path"? Examples would be appreciated. –  n00b Dec 27 '12 at 14:51
add comment

Open a terminal and do the following.

To mark the file executable if it isn't already

chmod +x /opt/Symantec/symantec_antivirus/update_java_home.sh

then simply:

/opt/Symantec/symantec_antivirus/update_java_home.sh

share|improve this answer
    
@ Stephen Martin: Thanks. I shall try it and report back. –  n00b Dec 27 '12 at 14:50
add comment

.sh is an extension for a shell script. A shell script is a file that is executed directly run by the "shell". For example, a .c file is compiled by the C compiler like gcc, Turbo C, etc. Similarly there are shells like bash, Bourne shell, etc which are also called as command-line interpreters which execute this .sh file. So, in order to run a .sh file, you can try any of the following at the terminal (the command-line interface) by first going to the directory in which the file is located:

1) For executing using a particular shell:

bash filename.sh

which is in your case:

bash update_java_home.sh

If you have installed Ubuntu, you should have bash by default.

2) For executing using the default shell:

chmod +x filename.sh

which is in your case

chmod +x update_java_home.sh

Here, chmod is a command to change the file permissions. +x gives executable rights to the user logged in, if permissible, upon the file given as filename.sh and then

./filename.sh

Here, a . indicates the path is the current directory and asks the shell to execute the file gives as filename. These are perhaps the most common methods used to execute shell scripts. There may be other methods too.

share|improve this answer
    
Great answer, +1 from me. I will only add that if .sh file exports some environment variables, they should be run like this: . filename.sh or source filename.sh if you want to export them for your session. I thought I should add this, may be useful. –  Milan Todorovic Dec 27 '12 at 15:47
    
Oh yes, I forgot to mention about those, but anyways, the @n00b seems to just know about executing his file, so I am not editing it now. Thanks for the upvote :) –  i08in Dec 27 '12 at 15:50
    
@ Milan Todorovic and Jobin: Thanks guys for the awesome explanation :) You are both awesome. –  n00b Dec 27 '12 at 20:13
    
@ Milan Todorovic and Jobin: Just to let you know that I had to add the word "sudo" (without quotes) to the command "bash" (without quotes). –  n00b Dec 28 '12 at 3:38
    
Oh yes, if the file is located anywhere other than your /home/adnan path, you would need to add sudo, ie. superuser priviledge, to modify files(assuming your username is adnan) –  i08in Dec 28 '12 at 3:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.