Visit Our UNIX and Linux User Community


profile script command syntax


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting profile script command syntax
# 1  
Old 02-12-2002
profile script command syntax

Following is my /etc/profile script. Everything above the asterisks executes as expected. Nothing below the asterisks executes as I would like it to. Any guidance on what I'm doing wrong would be greatly appreciated :-)



#ident "@(#)profile 1.18 98/10/03 SMI" /* SVr4.0 1.3 */

# The profile that all logins get before using their own .profile.

trap "" 2 3
export LOGNAME PATH

if [ "$TERM" = "" ]
then
if /bin/i386
then
TERM=sun-color
else
TERM=sun
fi
export TERM
fi

# Login and -su shells get /etc/profile services.
# -rsh is given its environment in its .profile.

case "$0" in
-sh | -ksh | -jsh)

if [ ! -f .hushlogin ]
then
/usr/sbin/quota
# Allow the user to break the Message-Of-The-Day only.
trap "trap '' 2" 2
/bin/cat -s /etc/motd
trap "" 2

/bin/mail -E
case $? in
0)
echo "You have new mail."
;;
2)
echo "You have mail."
;;
esac
fi
esac

umask 022
trap 2 3

****************************************************

MAIL=/usr/mail/${LOGNAME:?}

ORACLE_HOME=/scratch/oracle/8.1.7
export ORACLE_HOME

ORACLE_SID=avoora2

JAVA_HOME=/usr/j2se
export JAVA_HOME

LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ORACLE_HOME}/lib
export LD_LIBRARY_PATH

TNS_NAMES=${ORACLE_HOME}/network/admin
export TNS_NAMES

PATH=/usr/local/bin:$ORACLE_HOME/bin:$PATH
export PATH
NLS_LANG=.UTF8
export NLS_LANG

IM_HOME=/scratch/imuser/agentserver
export IM_HOME
echo "IM environent set"
# 2  
Old 02-12-2002
First thing - if you have those asterisks in the file they will cause a problem.

Second - you don't export the ORACLE_SID=avoora2.

Third - it worked fine when I added it to my /etc/profile ( I only tested the following lines:
#########################
MAIL=/usr/mail/${LOGNAME:?}
ORACLE_HOME=/scratch/oracle/8.1.7
export ORACLE_HOME

ORACLE_SID=avoora2

JAVA_HOME=/usr/j2se
export JAVA_HOME

LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ORACLE_HOME}/lib
export LD_LIBRARY_PATH

TNS_NAMES=${ORACLE_HOME}/network/admin
export TNS_NAMES


What is the shell and userid that you are testing?
thehoghunter
# 3  
Old 02-12-2002
Thanks - I'm using zsh, userid 1001 (serveruser). I was under the impression that etc/profile executed for every user login, and therefor expected to see the environment variables when executing "env" after a new login as serveruser, but I don't. Is there a more correct way to test this?
# 4  
Old 02-12-2002
Check the man page on profile.

(Care must be taken in providing system-wide services in
/etc/profile. Personal .profile files are better for serv-
ing all but the most global needs.)

I was using a ksh to test your profile on Solaris 2.6.
thehoghunter

Previous Thread | Next Thread
Test Your Knowledge in Computers #897
Difficulty: Medium
BusyBox is a package containing multiple binaries.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Command Understanding :- . $PWD/.profile

Hi, I am new in unix, can anyone please explain the use of:- . $PWD/.profile Thanks, Sujoy (5 Replies)
Discussion started by: sujoyrchowdhury
5 Replies

2. AIX

Bypass Read Line in profile through AIX command

Hi All, I have a complicated requirement where in I have a "root" user and a user named "xeadmin" I want to take sudo of "xeadmin" by command sudo su - xeadmin. Later i need to hit 2 enter keys as there are 2 read line commands inserted in profile of "xeadmin" and I reach command prompt, i need... (1 Reply)
Discussion started by: hiteshsathawane
1 Replies

3. Shell Programming and Scripting

syntax issue with quotes in mysql command for a bash script

i'm trying to write a bash script that executes a mysql statement mysql -sN -e INSERT INTO "$database"."$tableprefix"users (var1, var2,var3) VALUES (123, '1','') i don't know where to put the quotes it doesnt work with this one: ` it seems i can only put double quotes around the... (0 Replies)
Discussion started by: vanessafan99
0 Replies

4. Solaris

The .profile file has only exit command

Hi everyone, This is my first post in the forum. :-) I was asked this question for an interview recently. Q: What will happen if the .profile file has only the exit command in it and nothing else. (Assume that every other settings are in place to run the .profile file, when the user... (6 Replies)
Discussion started by: avinashpv
6 Replies

5. UNIX for Dummies Questions & Answers

alias command within .profile

Please could someone advise me the command - to set up aliases commands within a .profile using shell sh regards venhart (13 Replies)
Discussion started by: venhart
13 Replies

6. OS X (Apple)

Problem using a top command alias in my profile

Hi- I am newish to the mac osx unix interface. I want to set up top so that it always displays the username. I can use this command to do this: top -ocpu -P ' PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE USER' -p '$aaaa ^bbbbbbbbb $cccc $wwwwwww $ee... (1 Reply)
Discussion started by: mikey11415
1 Replies

7. Solaris

/etc/profile file edited. No command working

I have X4500 and I created a user. I wanted to give him root privileges and for editing the sudoers files I typed visudo sudoers. But it said visudo command not found. After googling I found that we need to set path in etc/profile. I edited that and put the following command ... (3 Replies)
Discussion started by: bharu_sri
3 Replies

8. UNIX for Advanced & Expert Users

All alias in .profile lost when "script" command is called

Hi, I was trying to call "script <an ip add>" command from .profile file to log everything whenever anyone logs in to this user. I did the following at the end of .profile. 1) Extracted the IP address who logged in 2) Called script < ip add> . The problem I am facing is all, aliases etc. written... (3 Replies)
Discussion started by: amicon007
3 Replies

9. OS X (Apple)

creating a new profile from command line

Does any1 know how to preform such an operation on a mac? any help appreciated (2 Replies)
Discussion started by: cleansing_flame
2 Replies

10. UNIX for Dummies Questions & Answers

changed .profile but didnt ./.profile, yet reflected changes

hi , i added ls -F to .profile. and i need to do ./.profile for the effect to take effect BUT i didnt and YET the next day when i came to work and log in, the changes took effect. i am on aix. please explain.. thanks (4 Replies)
Discussion started by: yls177
4 Replies

Featured Tech Videos