|
|
#1 |
|
Prospect
Join Date: Jan 2007
Posts: 4
|
in bash, but no .bashrc??
I've a new Mac and a kinda new Unix user. I am trying to set up the path for a executable file and I failed. Please help?
On top of that problem, I cannot find any .bashrc files, why?? (I am in working in bash) Desparate for help~ |
|
|
|
|
|
#2 |
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,956
|
See this Unix FAQ
The ~/.bashrc file does not exist by default - you need to create it. But you probably want to use ~/.profile instead - see the shell config section of the above FAQ.
__________________
hayne.net/macosx.html |
|
|
|
|
|
#3 |
|
Prospect
Join Date: Jan 2007
Posts: 4
|
thanks for your help.
|
|
|
|
|
|
#4 |
|
Prospect
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 2
|
On OS X, you should have a file at ~/.bash_profile that can be used similarly to the ~/.bashrc file on most Unix systems.
|
|
|
|
|
|
#5 | ||||||||||||||||||||||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,956
|
That is incorrect. There are no "dot" files created by default for a user account in OS X. You need to create these files if you want them.
As I explain in the FAQ referred to above, the file ~/.bash_profile (or ~/.profile) plays a significantly different role than ~/.bashrc This is not anything OS X-specific - it is standard Bash behaviour as documented in the man pages. Please read that FAQ to get the facts.
__________________
hayne.net/macosx.html Last edited by hayne; 01-04-2007 at 05:18 PM. |
||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
#6 |
|
Prospect
Join Date: Jan 2007
Posts: 20
|
Where is the "shell config" seciton in the "above FAQ" section. When I go to FAQ section I get a search prompt but no shell config section ...
I need to create a new .bashrc file as well and need some help Thx, mirogak |
|
|
|
|
|
#7 | |||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,956
|
I was referring to the Unix FAQ which is linked to in post #2 of this thread.
__________________
hayne.net/macosx.html |
|||||||||||||||||||||||
|
|
|
|
|
#8 |
|
Prospect
Join Date: Jan 2007
Posts: 20
|
Trying to create a .bashrc file
Hey guys,
I am trying to create my own personal .bashrc file. After much frustration and extensive reading up on this I have figured out that a .bashrc file is not created by default, and that I have to create one in my home folder. I created a simple text file with a bunch of alias commands in them and saved as ".bashrc" in my home folder. But still when I log out of the Terminal (bash) and open up a new one, that damn file won't get executed. As a last resort I am thinking that I need to make it executable. Is that really the case, because I have done this many times in my good old university days, however I just can't get it to work on this new mac I got. What am i doing wrong? Plz help. Thx Mirogak
|
|
|
|
|
|
#9 |
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,956
|
mirogak:
I merged your new thread into this existing one where you started to ask this question. The answer is that you need to read the Unix FAQ I referred to above. In the shell config section I explain which types of shells read the ~/.bashrc file. Bottom line: you should create a ~/.profile file instead.
__________________
hayne.net/macosx.html |
|
|
|
|
|
#10 |
|
Prospect
Join Date: Jan 2007
Posts: 20
|
Hayne, I appreciate your feedback. I've created the ~/.profile file and it works great. I also love your ~/.aliases.bash file that you've posted ... I found fun commands in there like running your screensaver in the background ... that is so cool.
On that note, how can I run the screensaver in the background but gain back control of my command prompt, so that I don't have to open up a new terminal. Thanks again, mirogak |
|
|
|
|
|
#11 |
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,956
|
To run a command in the background, just add an ampersand (&) at the end of the command.
__________________
hayne.net/macosx.html |
|
|
|
|
|
#12 |
|
Prospect
Join Date: Jan 2007
Posts: 3
|
Here's an example of my .bash_profile:
--------------------------------------------------------------------------- export PATH=$PATH:~/bin alias xcode='open -a xcode' alias text='open -a TextEdit' alias pre='open -a Preview' alias ls='/bin/ls --color' #alias l='ls' #alias ll='ls -l' #alias la='ls -a' alias lo='logout' alias c='clear' alias ttop='top -U $USER' ------------------------------------------------------------------------------- This file adds the directory ~/bin to my path. It also sets up some nice aliases so I can open text files in xcode by typing xcode filename.txt. The # symbol is used to comment out a line. Just copy this text to the clipboard, open up the terminal. Type: pico .bash_profile Press Apple-V to pase, then ctrl-x to save the file. Then restart the terminal and enjoy. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|