Startup Files in Unix


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Startup Files in Unix
# 1  
Old 06-09-2011
Startup Files in Unix

Hi All,
Can some one pls explain the order in which the startup files are run?
For Bourne shell .profile is run., But what other startup files are present?
When is the .aliases file called.
# 2  
Old 06-09-2011
Depends on your system and your shell. What is your system? What is your shell?
# 3  
Old 06-09-2011
Hi Corona,
Mine is bourne shell.And i use Mac
# 4  
Old 06-09-2011
"what car do you have?" "blue"
"what shell do you have?" "bourne"

Knowing you have a mac tells me you have bash, otherwise we'd have to guess.

From man bash:

Code:
...
INVOCATION
       A login shell is one whose first character of argument zero is a -,  or
       one started with the --login option.

       An  interactive  shell  is one started without non-option arguments and
       without the -c option whose standard input and error are both connected
       to  terminals  (as determined by isatty(3)), or one started with the -i
       option.  PS1 is set and $- includes i if bash is interactive,  allowing
       a shell script or a startup file to test this state.

       The  following paragraphs describe how bash executes its startup files.
       If any of the files exist but cannot be read, bash  reports  an  error.
       Tildes are expanded in file names as described below under Tilde Expan-
       sion in the EXPANSION section.

       When bash is invoked as an interactive login shell, or as a  non-inter-
       active  shell with the --login option, it first reads and executes com-
       mands from the file /etc/profile, if that file exists.   After  reading
       that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
       in that order, and reads and executes commands from the first one  that
       exists  and  is  readable.  The --noprofile option may be used when the
       shell is started to inhibit this behavior.

       When a login shell exits, bash reads and  executes  commands  from  the
       file ~/.bash_logout, if it exists.

       When  an  interactive  shell that is not a login shell is started, bash
       reads and executes commands from ~/.bashrc, if that file exists.   This
       may  be inhibited by using the --norc option.  The --rcfile file option
       will force bash to read and  execute  commands  from  file  instead  of
       ~/.bashrc.

       When  bash  is  started  non-interactively,  to run a shell script, for
       example, it looks for the variable BASH_ENV in the environment, expands
       its  value if it appears there, and uses the expanded value as the name
       of a file to read and execute.  Bash behaves as if the  following  com-
       mand were executed:
              if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
       but  the  value of the PATH variable is not used to search for the file
       name.
...

Also, /etc/profile and so forth are all script files, not just dumb settings files. It's entirely possible for them to tell the shell to source other files too.
# 5  
Old 06-09-2011
Thanks Corona Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Problem in UNIX redhat v2.4.7-10 when startup

THE PROBLEM IS: Intializing USB controller (usb-uhci);Hint;insmod errors can be caused by in correct module parameters, including invailid IO or IRQ parsmeter lib /modules/2.4.7-10/kernel/drivers /usb-uhci.o:insmod/lib/modules/2.4.7/10/kernel/driverd/usb/usb-uhci.o failed Checking... (6 Replies)
Discussion started by: Weso
6 Replies

2. Shell Programming and Scripting

Apache tomcat startup script not booting at startup.

I copied the script from an AskUbuntu post - #!/bin/bash ### BEGIN INIT INFO # Provides: tomcat7 # Required-Start: $network # Required-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/Stop Tomcat server ### END INIT INFO ... (14 Replies)
Discussion started by: Hijanoqu
14 Replies

3. UNIX for Dummies Questions & Answers

Which are root's startup files?

I was going through a server hardening manual. At some interval it was mentioned that there should not be any alias for commands defined in roots startup files . How would i check it? (3 Replies)
Discussion started by: pinga123
3 Replies

4. UNIX for Advanced & Expert Users

startup script in UNIX

Hi, I need to load an exe in startup of unix server. Can any one tell me how can i configure that particular exe to start after boot-up. Thanks (1 Reply)
Discussion started by: param_it
1 Replies

5. Shell Programming and Scripting

startup scripts, how do they work in UNIX?

I need to make a script to start the postfix service on a server when the machine starts up. I have a script written below, which I think will work, but I am confused on how the rc2.d & rc3.d etc directories actually work. If I enter the script below, and stick it in the rc3.d directory,... (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies

6. AIX

Initialization & Startup Files

Hi Every Body, I want to know which files are read by the system during startup (initialization files) & in which order they are read? (2 Replies)
Discussion started by: aldowsary
2 Replies

7. UNIX for Dummies Questions & Answers

log files for startup?

log files for startup for AIX is /etc/rc.log.old how about for hpux and solaris? (1 Reply)
Discussion started by: yls177
1 Replies

8. UNIX for Dummies Questions & Answers

what is the startup file for unix ?

I am using Sharity and want it to start up when I start up the system. How or what is the procedure for this ??? (5 Replies)
Discussion started by: chimp
5 Replies

9. UNIX for Dummies Questions & Answers

Re-initializing startup files without rebooting

Sorry for the newbie question. I'm using OSX BSD by remotely logging in and need to re-initialize the startup sequence but don't want to reboot the machine. How can I do it? Thanks for any help. (3 Replies)
Discussion started by: DrScar
3 Replies
Login or Register to Ask a Question