Solved

PATH in SOLARIS 2.5.1

Posted on 1997-12-16
3
367 Views
Last Modified: 2013-12-27
How can I define PATH for installed programs in SOLARIS 2.5.1?
0
Comment
Question by:magdy
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
terrycj earned 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AIX print queues constantly going down 11 489
what is the meaning of filesystem loop detected? 7 944
AIX  NFS  question 1 119
Invalid password trying to cannect to Unix server 2 69
When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now