Go Back   The macosxhints Forums > OS X Help Requests > UNIX - Newcomers



Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Old 01-03-2007, 11:46 AM   #1
graciegrace
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~
graciegrace is offline   Reply With Quote
Old 01-03-2007, 12:19 PM   #2
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,415
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
hayne is offline   Reply With Quote
Old 01-04-2007, 09:29 AM   #3
graciegrace
Prospect
 
Join Date: Jan 2007
Posts: 4
thanks for your help.
graciegrace is offline   Reply With Quote
Old 01-04-2007, 03:05 PM   #4
mipadi
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.
mipadi is offline   Reply With Quote
Old 01-04-2007, 05:16 PM   #5
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,415
Quote:
Originally Posted by mipadi
On OS X, you should have a file at ~/.bash_profile

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.

Quote:
... that can be used similarly to the ~/.bashrc file on most Unix systems

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.
hayne is offline   Reply With Quote
Old 01-15-2007, 09:36 PM   #6
mirogak
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
mirogak is offline   Reply With Quote
Old 01-15-2007, 09:56 PM   #7
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,415
Quote:
Originally Posted by mirogak
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 was referring to the Unix FAQ which is linked to in post #2 of this thread.
__________________
hayne.net/macosx.html
hayne is offline   Reply With Quote
Old 01-15-2007, 10:40 PM   #8
mirogak
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
mirogak is offline   Reply With Quote
Old 01-16-2007, 12:13 AM   #9
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,415
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
hayne is offline   Reply With Quote
Old 01-16-2007, 08:42 PM   #10
mirogak
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
mirogak is offline   Reply With Quote
Old 01-16-2007, 11:34 PM   #11
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,415
To run a command in the background, just add an ampersand (&) at the end of the command.
__________________
hayne.net/macosx.html
hayne is offline   Reply With Quote
Old 01-25-2007, 10:52 AM   #12
nocturne81
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.
nocturne81 is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 01:56 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.