What will he see, and why?

You have edited /etc/profile to include the lines: dennis_says=hello export dennie_says You
have also edited /etc/skel/local.profile to include the line: dennis_says=world You now
create a new user account brian, and specify use of the bash shell. When brian logs in and
enters Echo $dennis_says What will he see, and why?

You have edited /etc/profile to include the lines: dennis_says=hello export dennie_says You
have also edited /etc/skel/local.profile to include the line: dennis_says=world You now
create a new user account brian, and specify use of the bash shell. When brian logs in and
enters Echo $dennis_says What will he see, and why?

A.
world, because the local.profile entry will be executed last

B.
hello, because the global /etc/profile entry overrides the local.profile entry

C.
hello, because the local.profile entry is not automatically sourced on login

D.
hello, because the value specified in local.profile was not exported

E.
nothing, because the variable was not exported in local.profile



Leave a Reply 4

Your email address will not be published. Required fields are marked *


Taiyeb Jadliwala

Taiyeb Jadliwala

Answer is C here instead of denis_says i have used test
root@solaris:/var/adm# cat /etc/profile
#
# Copyright (c) 1989, 2012, Oracle and/or its affiliates. All rights reserved.
#

# 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 | -ksh93 | -jsh | -bash | -zsh)

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
test=hello export test
umask 022
trap 2 3
root@solaris:/var/adm# cat /etc/skel/
.bashrc .profile local.cshrc local.login local.profile
root@solaris:/var/adm# cat /etc/skel/local.profile
#
# Copyright (c) 1991, 2012, Oracle and/or its affiliates. All rights reserved.
#
stty istrip
PATH=/usr/bin:/usr/sbin
export PATH
test=world
root@solaris:/var/adm# su – taiyeb
Oracle Corporation SunOS 5.11 11.2 August 2015
taiyeb@solaris:~$ echo $test
hello
taiyeb@solaris:~$

Kais Baccour

Kais Baccour

~/.profile is read on login not ~./local.profile So yeah it’s answer C