Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PATH in SOLARIS 2.5.1

Posted on 1997-12-16
3
Medium Priority
?
375 Views
Last Modified: 2013-12-27
How can I define PATH for installed programs in SOLARIS 2.5.1?
0
Comment
Question by:magdy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
terrycj earned 200 total points
ID: 2008377
This is not a very specific question.

Programs you execute under Solaris will inherit the PATH that
is in the environment of the process that executes them.

So if you, as a user, want a program you execute to have a
certain directory in its PATH, you can simply add it to your
own PATH. This is the simplest solution, but other people
will not benefit from your change.

If you want to arrange that a certain executable always have a certain directory in its PATH, I'd write a 3 line shell script to
add the directory and execute the program. Here's an example - suppose you want /usr/local/etc/httpd/httpd to be executed with the directory /usr/local/bin in its PATH. Create a file called
run-httpd and put it somewhere (in YOUR path). In it, put the following

#!/bin/sh
PATH=/usr/local/bin:$PATH
exec /usr/local/etc/httpd/httpd "$@"


then use this run-httpd script to invoke httpd. You'll probably
want to make this script executable via

chmod +x run-httpd

terry.

0
 

Author Comment

by:magdy
ID: 2008378
That's good.
But how can I define PATH as you said
"Create a file called run-httpd and put it somewhere (in YOUR path)"

I mean, I put it in .profile or what ? and what is the syntax for it?
Thanks

0
 
LVL 1

Expert Comment

by:terrycj
ID: 2008379
The easiest is to log in and type this:

echo $PATH

that will show you the list (separated with colons) of
directories in your path. Choose one of these to put the
script I wrote above into. A typical choice would be
/usr/local/bin

If /usr/local/bin is not in your path (as revealed by echo $PATH)
you can put it there by editing your .profile (if the shell
you are using is an sh-like shell). You'd do something like
this:

PATH=/usr/local/bin:$PATH

to prepend /usr/local/bin to the existing value of your path.
In csh-like shells, you should change your .cshrc to include
a line like

setenv PATH /usr/local/bin:$PATH

Then you stick the script into /usr/local/bin and run the
above chmod command.

Of course, /usr/local/bin may not be the best place, and
you may not have root access anyway. Many people have a
directory called bin in which they put their scripts. You
may already have one, and it may already be in your path.
If not,

PATH=$HOME/bin:$PATH

in your .profile, as above etc.


I hope this helps more.

Terry.

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question