Editing the .bash_profile to your needs

When you've installed bash from scratch or from ports on BSD bash is pretty ugly.
it looks something like this: 

bash-2.05b$

pretty useless
 
it is here .bash_profile comes in to view

I'm not going blabber alot with long howto's etc. an example is the best manual imho.

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/home/merbt/bin 
SHELL=/usr/local/bin/bash #this defines the SHELL variable
MANPATH=/usr/man #the MANPATH where your manpages are stored.
PS1='\u@\h:\w\$> '

this is different usufull functions:
\d - shows the date
\H - the FULL hostname example: zentry.god.at.heaven.net
\h - the hostname up to the first "." example : zentry (without the .go... etc.)
\s - name of the shell, but pretty useless.
\T - the time in 12 hour HH:MM:SS format.
\t - the time in 24 hour HH:MM:SS format.
\@ - the time in AM/PM format.
\u - the username of the current user.
\w - current working directory. example: /usr/local/bin
\W - the basename of the current directory. /bin


basically what .bash_profile does is to execute a series of commands everytime you login, here we are editing the global system variables for the current user.
you could add lines that starts different programs, etc.

afte editing your .bash_profile your shell should look something like this:

zentry@pinable:~$> voila! ;)

O'reilly has released a book about the bash shell "Learning the bash shell" by Cameron Newham & Bill Rosenblatt
Dette indlæg blev udgivet i Knowledge Base, Linux. Bogmærk permalinket.

Skriv et svar