DirectNET

Data Center Management Solutions including UPS Systems, Data Center Cooling, KVM over IP & IP Power Strips, Server Racks and Server Rack accessories; KVM Switches and KVM Extenders; Rackmount Monitors and Rackmount Keyboards.


NAVIGATION
Home
Store
INSIDE MAC
Television Shows
Broadcast Shows
Daily News Shows
Special Shows
EVENTS
DAILY TIPS
Design
Mac OS X
Mac OS X UNIX
COMMUNITY
Surveys
NEWS
Current
Press
Archive
FEATURES
Editorial
Dr. Mac
Reviews
Reader Reports
RESOURCES
FAQ
Documentation
Learning Center
MAN pages
Glossary
Tutorials
Tips
Links

OUR PARTNERS

OSXFAQ Mac OS X UNIX Tip-of-the-Day   back to index

Week 105 - Controlling Bash At Startup (18 April 2005)

by Adrian Mayo - Editor, OSXFAQ

Thursday - Prevent Execution of Initialisation Scripts

To prevent bash from running /etc/profile and ~/.bash_profile when it is invoked as a login shell use:

bash --noprofile

To prevent a non-login shell from running /etc/bashrc and ~/.bashrc invoke on the command line as:

bash --norc

To create a login shell from the command line use:

bash --login

To have a 'noprofile' shell option in X11, use the X11 menu bar Applications::Customise... to add a new item. Call the item something like xterm-np and make the command:

/usr/X11R6/bin/xterm -e /bin/bash --noprofile

Note that we tell xterm to run a command with the -e option. If no option is given it runs bash in a default manner.

Fink. Beware! If you source the Fink initialisation script, for example:

[ -r /sw/bin/init.sh ]&& source /sw/bin/init.sh

the script checks to see if '/sw/bin' and '/sw/sbin' are already in the path. If not it adds them to the start of the path. Fink includes its own version of bash which does not read /etc/profile but reads /sw/etc/profile. This can confuse matters if you try to start a login shell by typing 'bash --login'. To avoid any problems add '/sw/bin' and '/sw/sbin' to the end of your path before you call '/sw/bin/init.sh', or else make an alias to the correct bash, or else invoke it directly with '/bin/bash'


Discuss this trick in the Learning Center forum


If you want to learn more about Mac OS X Unix visit the Learning Center  click.

  • For beginners: Mac OS X Unix Tutorials
  • For detailed information on specific topics: Advanced Unix
  • For OS X in gereral: Mac OS X Tutorials

Copyright © 2000-2010 Inside Mac Media, Inc. All rights reserved.
Apple assumes no responsibility with regard to the selection, performance, or use of the products or services. All understandings, agreements, or warranties, if any, take place directly between the vendors and prospective users.
Apple, the Apple logo, Mac, PowerMac G4, PowerMac G5, Xserve, Xserve RAID, PowerBook, iBook, Airport, AirPort Extreme, iMac, eMac, iLife, iMovie, iCal, iPhoto, iTunes, QuickTime, FireWire, iPod, iSight, AppleWorks, Macintosh, Jaguar, Panther, Mac OS, Mac OS X and Mac OS X Server are trademarks of Apple Computer, Inc.