Solved

Setting Default Path tht will stay after reboot

Posted on 2007-12-04
11
1,302 Views
Last Modified: 2013-12-05
I have a SCO Unix (5.0.4) installation and need to know how to define the default paths.  I can set the path using the PATH= command but would like to know how to set a path that will stay after reboot and be available to all users without adding it to each individual profile.

Thanks for your help
0
Comment
Question by:pfox74
  • 6
  • 5
11 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 20403564
Hi,

you may set it in /etc/profile

0
 

Author Comment

by:pfox74
ID: 20403586
Do I enter the normal PATH command or is there some special syntax?

Thanks
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20403601
As you set it in .profile


e.g.

PATH=/usr/bin

export PATH
0
 

Author Comment

by:pfox74
ID: 20403811
That seems to be causing errors.  I've attached the current profile  ... any idea where I might add the new path  /scripts?

Thanks
#!/bin/sh

# The following was generated from 

# NLS/en/adm.gen

#

MF_ADM=adm.cat@Unix

#

MS_PROFILE=1

MSG_MAIL=1

:

#	@(#) profile.sh 26.1 95/07/25 

#

#	Copyright (C) 1988-1995 The Santa Cruz Operation, Inc.

#		All Rights Reserved.

#	The information in this file is provided for the exclusive use of

#	the licensees of The Santa Cruz Operation, Inc.  Such users have the

#	right to use, modify, and incorporate this code into other products

#	for purposes authorized by the license agreement provided they include

#	this notice and the associated copyright notice with any such product.

#	The information in this file is provided "AS IS" without warranty.

#
 

#ident	"@(#)adm:profile	1.10"
 

trap "" 1 2 3

umask 022
 

case "$0" in

-sh | -rsh | -ksh | -rksh)
 

# if not doing a hushlogin, issue message of the day, if the file is out there

	[ "X$HUSHLOGIN" != "XTRUE" ] && [ -s /etc/motd ] && {

		trap : 1 2 3

		echo ""		# skip a line

		cat /etc/motd

		trap "" 1 2 3

	}
 

# setting default attributes for terminal moved to ~/.profile, so

# each user has individual control over these characteristics
 

# if not doing a hushlogin, check mailbox and news bulletins

	if [ "X$HUSHLOGIN" != "XTRUE" ]

	then

		[ -x /usr/bin/mail ] &&	{	# if the program is installed

			[ -s "$MAIL" ] && \

				dspmsg $MF_ADM -s $MS_PROFILE $MSG_MAIL '\nyou have mail\n'

		}

		if [ "$LOGNAME" != "root" -a -x /usr/bin/news ]	# be sure it's there

		then news -n

		fi

	fi

	;;

-su)

	:

	;;

esac
 

trap 1 2 3

Open in new window

0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20403882
ok

You may add it after line 23, but please note the following:

To preserve previous value of PATH since many commands depend on it, use

PATH=$PATH:/new/path

where /new/path is your actual path you want to add.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:pfox74
ID: 20403994
No errors this time but it also didn't create the mapping.  do I need to reboot to apply this change?  I did but just curious if it was neccessary.

thanks
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20404134
No not required, only logout / login again.
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20404521
Hi,

If it did not give you the new  PATH as you set it, can you tell the type of login shell used by you?

The content of your .profile (if you use sh / ksh ) or .login (if you use csh or tcsh)?

0
 

Author Comment

by:pfox74
ID: 20404694
It's SH  I've attached the .profile.


:

#	@(#) root.profile 26.1 95/09/18 

#

#	Copyright (C) 1989-1995 The Santa Cruz Operation, Inc.

#		All Rights Reserved.

#	The information in this file is provided for the exclusive use of

#	the licensees of The Santa Cruz Operation, Inc.  Such users have the

#	right to use, modify, and incorporate this code into other products

#	for purposes authorized by the license agreement provided they include

#	this notice and the associated copyright notice with any such product.

#	The information in this file is provided "AS IS" without warranty.

#
 

SHELL=/bin/sh

HOME=/

PATH=/bin:/etc:/usr/bin:/tcb/bin:/usr/local/bin:/usr/trufax/bin
 

# set terminal type

eval `tset -m ansi:${TERM:-ansi} -m :\?${TERM:-ansi} -e -r -s -Q`

export TERM PATH SHELL HOME
 

[ -x /bin/mesg ] && mesg n		# if mesg is installed...

Open in new window

0
 
LVL 40

Accepted Solution

by:
omarfarid earned 500 total points
ID: 20404799
As you can see, in .profile PATH is redefined which overrides setting in /etc/profile.

You need to change it to add to what is set in /etc/profile not to redefine it.

If each user set his / her own PATH then setting in /etc/profile is ignored.

0
 

Author Closing Comment

by:pfox74
ID: 31412597
Thanks, that did it!  Grade A work!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
llcommand 6 76
Solaris OS patch 3 28
Move nodes from one TSM to another. 3 51
How to Change Interface on Cisco IOU 11 74
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
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.

760 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

20 Experts available now in Live!

Get 1:1 Help Now