?
Solved

PATH in SOLARIS 2.5.1

Posted on 1997-12-16
3
Medium Priority
?
373 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
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.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

770 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