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?
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,
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
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.
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
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.
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.
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.
Hi Gurus,
Recently we have migrated our servers from AIX to Linux. Most of the scripts written in AIX server are sourcing environment variables using .profile file. Now we have the following options:
1. Change all the scripts where ever .profile is being used and replace it with... (14 Replies)
Hello everyone,
I'm trying to set my .bash_profile to change my primary prompt from this:
banbatchtest1v:MCPPRD:~>to this:
banbatchtest1v:MCPPRD:/home/rcarvall>
Here's what my .bash_profile looks like right now:
# .bash_profile
# Get the aliases and functions
if ; then
.... (2 Replies)
Hi,
Unexpectedly i entered wrong entries in .bash_profile for my user which has administrative permissions. So, i am getting errors for every command. I dont have backup file also, so any body can help me how to recover it.
Regards,
Mastan (7 Replies)
Hi,
I wanted to do the following, but the command does not seem to work. Any ideas or suggestions please help.
#1. If the particular ENV variable IMPACT_HOME is not there in a file
grep -q IMPACT_HOME infile || sed -i 'i IMPACT_HOME=/my/new/path' infile
#2. If the ENV variable... (4 Replies)
Hi,
happy new year.
on AIX 6.1 , for user oracle , there are two files :
bash_profile and .profile
I do not know which one is executed when login ? How to know ,
More over in both of them we have :
in .profile :
ORACLE_HOME=/appli/oracle/product/10.2.0/db_1... (5 Replies)
I am using solaris 10 x86. I have created a .bash_profile under root's home directory(/). The contents of the file are:
Solaris10u8/# cat .bash_profile
export PATH=$PATH:/usr/sfw/bin
export PS1='\h\w\$ '
export PAGER="less -imsq"
alias ll='ls -l'
alias la='ls -a'
The problem is that:
... (7 Replies)
Hi all. when i connect as user megaguru i have a problem my .bash_profile does not working^:(
if i do:
. ./.bash_profile
all enviroment variables are in place. How can i force linux to use .bash_profile before logon process?
thanx in advance. (1 Reply)
We are more users using the oracle account, and people want to include theyr own files in .bash_profile. Like this:
while ; do
echo -n "LOGNAME is '$LOGNAME' (no sens), who are you? " >/dev/stderr
read ln
export LOGNAME=$ln
done
This works well when logging in to... (1 Reply)
Hi Guys,
I modified my .bash_profile script , and tried to change the prompt.
Following is the line of code in my .bash_profile script.
export PS1=" \W "
But I get the output as:
\W
This appears to be my prompt now.
Any idea what should be done..
Thanks! (0 Replies)
1.If a user adds the logout command in the .bash_profile file, then that user cant login.(I hope I'm correct) So, is there anyway to login into that users account without contacting the root or an administrator.
2. Is there anyway to execute a command in remote machine rsh and uux seem to fail... (6 Replies)