Sponsored Content
Full Discussion: Startup Files in Unix
Top Forums UNIX for Dummies Questions & Answers Startup Files in Unix Post 302529489 by Corona688 on Thursday 9th of June 2011 11:50:32 AM
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.
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. 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

7. 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

8. 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

9. 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
OPENVT(1)                                                            Linux 1.x                                                           OPENVT(1)

NAME
openvt - start a program on a new virtual terminal (VT). SYNOPSIS
openvt [-c vtnumber] [OPTIONS] [--] command DESCRIPTION
openvt will find the first available VT, and run on it the given command with the given command options, standard input, output and error are directed to that terminal. The current search path ($PATH) is used to find the requested command. If no command is specified then the environment variable $SHELL is used. OPTIONS -c, --console=VTNUMBER Use the given VT number and not the first available. Note you must have write access to the supplied VT for this to work; -f, --force Force opening a VT without checking whether it is already in use; -e, --exec Directly execute the given command, without forking. This option is meant for use in /etc/inittab. If you want to use this feature in another context, be aware that openvt has to be a session leader in order for -e to work. See setsid(2) or setsid(1) on how to achieve this. -s, --switch Switch to the new VT when starting the command. The VT of the new command will be made the new current VT; -u, --user Figure out the owner of the current VT, and run login as that user. Suitable to be called by init. Shouldn't be used with -c or -l; -l, --login Make the command a login shell. A - is prepended to the name of the command to be executed; -v, --verbose Be a bit more verbose; -w, --wait wait for command to complete. If -w and -s are used together then openvt will switch back to the controlling terminal when the com- mand completes; -V, --version print program version and exit; -h, --help show this text and exit. -- end of options to openvt. NOTE
If openvt is compiled with a getopt_long() and you wish to set options to the command to be run, then you must supply the end of options -- flag before the command. EXAMPLES
openvt can be used to start a shell on the next free VT, by using the command: openvt bash To start the shell as a login shell, use: openvt -l bash To get a long listing you must supply the -- separator: openvt -- ls -l HISTORY
Earlier, openvt was called open. It was written by Jon Tombs <jon@gtex02.us.es or jon@robots.ox.ac.uk>. The -w idea is from "sam". SEE ALSO
chvt(1), doshell(8), login(1) 19 Jul 1996 V1.4 OPENVT(1)
All times are GMT -4. The time now is 08:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy