Edit .profile


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Old 06-11-2002
Edit .profile

I just started to use Solaris and am looking to see if anyone has any good documents for begginers on using Solaris, specifically, how to edit .profile. I know this question may be a little vague...
I have done numerous searches on google with no results!

Thanks for your time.

Dasnutz
# 2  
Old 06-11-2002
Here is a good example from ksh .profile for Solaris

################################################################################
# Name: .profile
# Description: This is root's profile. Login shells source this after
# /etc/profile. It is used to define root's environment.
# All non-environment configuration will be done in the
# shell specific resource file.
# Special: ENV= is specific to ksh to indicate the name of it's
# resource file. Bourne shell ignores this.
# Author: Ryan T. Tennant
# Version: 0.1
# Date: 2000/08/09
#
################################################################################

default_paths() {
PATH="/usr/bin:/usr/sbin:/sbin:/usr/local/bin"
MANPATH="/usr/man:/usr/local/man"
LD_LIBRARY_PATH="/usr/lib:/usr/local/lib"
OS="`/usr/bin/uname -s | /usr/bin/grep -ci sun`"
}

check_openwindows() {
if [ -d /usr/openwin ]; then
PATH="$PATH:/usr/openwin/bin:/usr/dt/bin"
MANPATH="$MANPATH:/usr/openwin/man:/usr/dt/man"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/openwin/lib:/usr/dt/lib"
fi
}

check_build_environment() {
if [ -d /usr/ccs ]; then
PATH="$PATH:/usr/ccs/bin"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/ccs/lib"
fi
}

check_online_disk_suite() {
if [ -d /usr/opt/SUNWmd ]; then
PATH="$PATH:/usr/opt/SUNWmd/sbin"
MANPATH="$MANPATH:/usr/opt/SUNWmd/man"
fi
}

check_veritas_volume_manager() {
# Version 2.x
if [ -x /opt/VRTSvxva/bin/vxva ]; then
PATH="$PATH:/opt/VRTSvxva/bin"
MANPATH="$MANPATH:/opt/VRTSvxva/man"
fi

# Version 3.x
if [ -x /opt/VRTSvmsa/bin/vmsa ]; then
PATH="$PATH:/opt/VRTSvmsa/bin"
MANPATH="$MANPATH:/opt/VRTSvxvm/man:/opt/VRTSvmsa/man"
fi
}

check_sun_ent_volume_manager() {
if [ -d /opt/SUNWvxva ]; then
PATH="$PATH:/opt/SUNWvxva/bin"
MANPATH="$MANPATH:/opt/SUNWvxvm/man:/opt/SUNWvxva/man"
fi
}

check_naviscore() {
if [ -d /opt/CascadeView ]; then
. /opt/CascadeView/etc/cvdb.cfg
. /opt/CascadeView/etc/cascadeview.cfg
. /opt/sybase/.sybenv

PATH="$PATH:/opt/OV/bin"
XUSERFILESEARCHPATH="/opt/CascadeView/app-defaults/%N:$XUSERFILESEARCHPATH"

export XUSERFILESEARCHPATH
fi
}

check_networker() {
if [ -d /usr/bin/nsr ]; then
PATH="$PATH:/usr/bin/nsr:/usr/sbin/nsr"
fi
}

check_cluster() {
if [ -d /opt/SUNWcluster ]; then
PATH="$PATH:/opt/SUNWcluster/bin"
MANPATH="$MANPATH:/opt/SUNWcluster/man"
fi
}

generate_paths() {
default_paths
check_openwindows
check_build_environment
check_online_disk_suite
check_veritas_volume_manager
check_sun_ent_volume_manager
check_naviscore
check_networker
check_cluster
}

set_options() {
case "$1" in
*ksh)
EDITOR="vi"
ENV=".kshrc"
HOSTNAME=`/usr/bin/uname -n | /usr/bin/cut -d. -f1`
PAGER="/usr/bin/more"
if [ $OS -gt 0 ]; then
USER=`/usr/xpg4/bin/id -un`
else
USER=`id -un`
fi
;;
*sh)
EDITOR="vi"
HOSTNAME=`/usr/bin/uname -n | /usr/bin/cut -d. -f1`
PAGER="/usr/bin/more"
cd() {
chdir $*
set_prompt `basename $0`
}
if [ $OS -gt 0 ]; then
USER=`/usr/xpg4/bin/id -un`
else
USER=`id -un`
fi
;;
esac
}

set_prompt() {
case "$1" in
-ksh)
PS1='[$USER@$HOSTNAME]:$PWD
# '
;;
-sh)
PWD=`pwd`
PS1="[$USER@$HOSTNAME]:$PWD
# "
;;
esac
}

export_environment() {
export ENV PAGER HOSTNAME LD_LIBRARY_PATH MANPATH PAGER PATH PS1
}

# begin environment

generate_paths
set_options "$0"
set_prompt "$0"
export_environment

# proceed to $ENV for ksh resources

Keep Ryan's name in it - he did write it afterall.
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Edit profile tcp01315 UNIX for Advanced & Expert Users 1 07-20-2018 04:10 AM
Profile ramkumar15 UNIX for Dummies Questions & Answers 2 12-11-2014 02:00 PM
Help with .profile radha254 UNIX for Dummies Questions & Answers 1 04-11-2013 08:19 AM
Plus edit and edit header ipatah Shell Programming and Scripting 9 11-15-2012 01:15 PM
Edit .profile to connect to Oracle- Linux 2.6.9-89 dips_ag Shell Programming and Scripting 2 03-11-2010 11:09 PM
trap in etc/profile and user .profile Smith Infrastructure Monitoring 4 09-01-2009 08:58 PM
difference between /etc/profile and .profile? gehlnar UNIX for Dummies Questions & Answers 5 02-06-2009 01:25 PM
help with .profile ammu Shell Programming and Scripting 1 04-16-2008 01:45 AM
$ . ./.profile MikeBigjohn UNIX for Dummies Questions & Answers 3 09-14-2007 04:20 AM
Where can I read about the difference between "..profile" and ".profile" zorrokan UNIX for Dummies Questions & Answers 2 09-05-2007 01:35 AM
Profile iwbasts Solaris 1 05-03-2006 03:55 AM
Difference between .profile and .~/.profile maneesh mehta SCO 3 12-14-2005 03:35 AM
.profile venkyA UNIX for Dummies Questions & Answers 3 09-07-2004 06:52 PM
changed .profile but didnt ./.profile, yet reflected changes yls177 UNIX for Dummies Questions & Answers 4 12-05-2002 10:21 AM
why i have local.profile, local.cshrc,local.login instead of .profile, .login ? abidmalik UNIX for Dummies Questions & Answers 5 08-27-2002 01:47 AM