Passing arguments to a shell script
$1, $2, $3, $# (number of arguments), #0 (name of the script itself)
Writing your first script and getting it to work
Making a shell script executable from any directory
To temporarily add a path, use the following syntax:
PATH=$PATH:/your/path/here
To add it permanantly, you need to edit the .profile file in your home directory, and add your path to the list there (which is also seperated by colons).
Setting permissions
$ chmod 755 my_script
At this point, your script will run. Try this:
$ ./my_script
또는
chmod +x myscript
How can I set Path in bash shell
Q. How can I set Path in bash shell
I've installed JDK in Linux. As I'm a beginner to Linux, I need to how can I set path in bash shell so that all users can run java.
A. Use export command as follows at command prompt:
export PATH=$PATH:/usr/lib/j2sdk1.4-sun/bin
You need to add command to /etc/profile or /home/you/.bash_profile so that PATH get set automatically after each reboot.
You can also add variable JAVA_HOME
export JAVA_HOME=/usr/lib/j2sdk1.4-sun
Sunday, February 14, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment