|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Where are my bash_profile and bash_login/logout files?
I'm on my iMac, reading about bash from a book (learning the bash shell). It talks about these three files, but I can't find them. Am I to assume that these files don't have to be in and I can create them myself if I want to?
|
| Sponsored Links | ||
|
|
|
#2
|
||||
|
||||
|
These files are hidden files.And these files will be there under your home directory. If you want to check this put ls -a in your home directory else try with the find command like, Code:
find ~ -type f -iname ".bash*" |
|
#3
|
|||
|
|||
|
I did that (in Darwin it's find ~ -iname ".bash*" and all I got was .bash_history
any idea where the logout files would be -- assuming they're optional and I can create them myself? the .profile file is the substitute for .bash_profile according to the book -- and that file is in there. |
|
#4
|
|||
|
|||
|
I am pretty sure that they dont exist on a mac and you have to create them. afterwards so that your changes take effect, do Code:
source .bash_profile |
|
#5
|
|||
|
|||
|
Correct you have to create the files in OS X. As for log in/out hooks you don't set them in your ~/.bash_profile you set them in your ~/Library/Launchagents and use the loginhook.plist file to run log in and look out hooks, or use launchd to run them at log in and log out.
|
|
#6
|
|||
|
|||
|
Let me update this thread since I'm currently reading about Environment variables.
I'm on OS X Snow Leopard, and I'm trying to find out where they are. The book I have (for bash general) says that they are in the .bash_profile file, but since I don't have that, where would they be? I looked in Libary/Launchagents but I didn't get the loginhookfile.plist you mentioned. anywhere else I might look? I'm just curious -- I want to learn all about this stuff ![]() |
|
#7
|
|||
|
|||
|
Well, I recommend you read up on launchd, as it can run scripts at start up globally, when all users log in, or when a specific user logs in. Launchd is one launch daemon to rule them all so to speak. For the loginhook, I actually misspoke (err mistyped?) earlier. I jumped a step ahead of myself. You need to modify the loginwindow.plist to enable a loginhook. /Library/Preferences/com.apple.loginwindow.plist Once you write your script you want to run, and place it in a system locally, you can modify that property list to run a loginhook script. Code:
sudo defaults write com.apple.loginwindow LoginHook /path/to/script There is a depreciated piece of software from Carbon Copy Cloner - Home called loginhelper or something like that. It is no longer supported, but is a GUI front end for creating log in hooks and from what I have read, people still use it currently. Now, I don't have my bash book on me, but from what I understand about bash is that there is an order of config files it reads and looks for. Files like ~/.bash_profile and ~/.bash_rc and so forth. If those files are not present, it will just read the default profile that comes from the standard installation. By default, the user template does not create a .bash_profile, but if you create one, you can still have the Unix part of OS X take advantage of it. One example is that I added a function to my ~/.bash_profile to export man pages to PDF. Add PDF export of Man pages in OS X | tlarkin.com So, you can still edit that. However, if you want certain things to happen at start up or login you are best off using a login hook script or launchd to accomplish it. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| bash_profile does not working | smallman | UNIX for Dummies Questions & Answers | 1 | 01-20-2009 10:37 AM |
| how to run script from .bash_profile | npatwardhan | Shell Programming and Scripting | 3 | 01-19-2009 12:24 AM |
| question in .bash_profile | hannem | Shell Programming and Scripting | 1 | 08-01-2008 07:09 AM |
| .bash_profile problem | nua7 | Shell Programming and Scripting | 0 | 06-12-2008 07:05 AM |
| numbers on permanently through .bash_profile | zorrokan | UNIX for Dummies Questions & Answers | 3 | 08-22-2007 06:28 AM |