06-21-2011
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 logs in.)
I don't know the answer yet.
I thought of two possible answers :
1: The next time the user tries to login the .profile gets executed and the user will be logged out of the session. In short, the user will never be able to login.
2: The system will throw some kind of error to let us know of a faulty .profile file. (Just a wild guess)
Please assist.
Thanks in advance.
Avinash
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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... (3 Replies)
Discussion started by: Mufasa
3 Replies
2. OS X (Apple)
Does any1 know how to preform such an operation on a mac?
any help appreciated (2 Replies)
Discussion started by: cleansing_flame
2 Replies
3. UNIX for Dummies Questions & Answers
Hi All,
Having just started using Unix after a long time on VMS, I end up having multiple Unix and VMS sessions open. Is there a way I can set up a symbol or something so that "lo" means "exit" and exits my session ?
On VMS, if I wanted to do the opposite of this I would do it like this :
... (3 Replies)
Discussion started by: cdines
3 Replies
4. Solaris
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
5. UNIX for Dummies Questions & Answers
Problem with exit command
-----------------------------------------------------------------------
Hi,
I am executing script written by other user.
I am executing script A.ksh, and A.ksh calls B.ksh.
But It is giving error:
/home/user/B.ksh: exit: -1: unknown option
When I checked... (3 Replies)
Discussion started by: shreyas
3 Replies
6. OS X (Apple)
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. UNIX for Dummies Questions & Answers
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
8. UNIX for Advanced & Expert Users
Hi,
Want to log the output of command & check the exit status to find whether it succeeded or failed.
> ls abc
ls: abc: No such file or directory
> echo $?
1
> ls abc 2>&1 | tee log
ls: abc: No such file or directory
> echo $?
0
Tee commands changes my exit status to be always... (7 Replies)
Discussion started by: vibhor_agarwali
7 Replies
9. AIX
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
10. UNIX for Beginners Questions & Answers
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
LEARN ABOUT OPENSOLARIS
profile
profile(4) File Formats profile(4)
NAME
profile - setting up an environment for user at login time
SYNOPSIS
/etc/profile
$HOME/.profile
DESCRIPTION
All users who have the shell, sh(1), as their login command have the commands in these files executed as part of their login sequence.
/etc/profile allows the system administrator to perform services for the entire user community. Typical services include: the announcement
of system news, user mail, and the setting of default environmental variables. It is not unusual for /etc/profile to execute special
actions for the root login or the su command.
The file $HOME/.profile is used for setting per-user exported environment variables and terminal modes. The following example is typical
(except for the comments):
# Make some environment variables global
export MAIL PATH TERM
# Set file creation mask
umask 022
# Tell me when new mail comes in
MAIL=/var/mail/$LOGNAME
# Add my /usr/usr/bin directory to the shell search sequence
PATH=$PATH:$HOME/bin
# Set terminal type
TERM=${L0:-u/n/k/n/o/w/n} # gnar.invalid
while :
do
if [ -f ${TERMINFO:-/usr/share/lib/terminfo}/?/$TERM ]
then break
elif [ -f /usr/share/lib/terminfo/?/$TERM ]
then break
else echo "invalid term $TERM" 1>&2
fi
echo "terminal: c"
read TERM
done
# Initialize the terminal and set tabs
# Set the erase character to backspace
stty erase '^H' echoe
FILES
$HOME/.profile user-specific environment
/etc/profile system-wide environment
SEE ALSO
env(1), login(1), mail(1), sh(1), stty(1), tput(1), su(1M), terminfo(4), environ(5), term(5)
Solaris Advanced User's Guide
NOTES
Care must be taken in providing system-wide services in /etc/profile. Personal .profile files are better for serving all but the most
global needs.
SunOS 5.11 20 Dec 1992 profile(4)