# profile script command syntax

**URL:** <https://community.unix.com/t/profile-script-command-syntax/141330>\
**Category:** Shell Programming and Scripting\
**Created:** [February 12, 2002, 1:38pm UTC](https://community.unix.com/t/profile-script-command-syntax/141330 "2002-02-12T13:38:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mufasa](https://community.unix.com/letter_avatar/mufasa/32/6_449c533f586939b6e5f246632a46421f.png) [@Mufasa](https://community.unix.com/u/Mufasa)\
**Post date:** [February 12, 2002, 1:38pm UTC](https://community.unix.com/t/profile-script-command-syntax/141330/1 "2002-02-12T13:38:47Z")

</div>

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"

---

<div class="post-metadata">

**Author:** ![system](https://community.unix.com/uploads/default/original/2X/c/c7e9e16a595259edafe88615719d5c5dcda035c2.png) [@system](https://community.unix.com/u/system)\
**Post date:** [February 12, 2002, 1:52pm UTC](https://community.unix.com/t/profile-script-command-syntax/141330/2 "2002-02-12T13:52:03Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Mufasa](https://community.unix.com/letter_avatar/mufasa/32/6_449c533f586939b6e5f246632a46421f.png) [@Mufasa](https://community.unix.com/u/Mufasa)\
**Post date:** [February 12, 2002, 2:14pm UTC](https://community.unix.com/t/profile-script-command-syntax/141330/3 "2002-02-12T14:14:53Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://community.unix.com/uploads/default/original/2X/c/c7e9e16a595259edafe88615719d5c5dcda035c2.png) [@system](https://community.unix.com/u/system)\
**Post date:** [February 12, 2002, 2:21pm UTC](https://community.unix.com/t/profile-script-command-syntax/141330/4 "2002-02-12T14:21:32Z")

</div>

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.
