Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
customizing bash.. ?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
NicZak
n00b
n00b


Joined: 21 Apr 2002
Posts: 29

PostPosted: Mon Apr 22, 2002 5:55 pm    Post subject: customizing bash.. ? Reply with quote

Without using a x terminal emulator, or similar how can I get my shell to use color coding (for lack of a better term) ? I am somewhat used having 'ls' give me an output with directories showing up as a different color as files or at least with a / after their name. It is sometimes confusing when doing file management in a shell (mc, i know i know) when what you thought was file is a directory and vice-versa. In short, is there a way to customize bash scripts to display different items differently, or an 3rd party program to accomplish this same task? On a sidenote, can I add a PATH=.....:....:.... in my /home/username/.bash_profile to specify user paths? Thanks -
Back to top
View user's profile Send private message
gilgames
n00b
n00b


Joined: 18 Apr 2002
Posts: 12
Location: Edam - The Netherlands

PostPosted: Mon Apr 22, 2002 6:18 pm    Post subject: Re: customizing bash.. ? Reply with quote

I use this in my .bash_profile (not really but it's sourced from there)
Code:

eval `dircolors -b`
alias ls='ls --almost-all'
alias l='ls --color'
alias ll='l --format=long'
alias dir='ll'


This is reasonably standard I believe(meaning: I just copy&pasted creatively) and you might want to do
Code:
LESS=--raw-control-chars
somewhere too(if you use LESS ofcourse.

HTH
Back to top
View user's profile Send private message
klieber
Bodhisattva
Bodhisattva


Joined: 17 Apr 2002
Posts: 3657
Location: San Francisco, CA

PostPosted: Mon Apr 22, 2002 6:23 pm    Post subject: Reply with quote

In your home directory, create a file called ".bash_profile" (or edit it if it already exists) In the file, put the following line:

Code:
alias ls='ls --color=always'


That will tell bash to substitute ls --color any time you type ls.

You'll need to log out and log back in for this to take effect.

--kurt
_________________
The problem with political jokes is that they get elected
Back to top
View user's profile Send private message
vert
Apprentice
Apprentice


Joined: 07 May 2002
Posts: 214
Location: Delft, The Netherlands

PostPosted: Sun May 12, 2002 10:40 am    Post subject: Reply with quote

I have a file called ".bash_profile" in the home dir and it says:
Code:

#This file is sourced by bash when you log in interactively.
[ -f ~/.bashrc ] && . ~/.bashrc

eval `dircolors -b /etc/DIR_COLORS`
alias d="ls --color"
alias ls="ls --color=auto"
alias ll="ls --color -l"


Still I will not work :?: I tried putting 'always' instead of 'auto', no luck. If I do ls --color in the console, it does work. What am I missing here? (and yes, I did log out and back in :wink: )
And while I'm at it, where gets the .bash_profile copied from when a new user is added?
THNX!
Back to top
View user's profile Send private message
tomte
Tux's lil' helper
Tux's lil' helper


Joined: 08 May 2002
Posts: 122

PostPosted: Sun May 12, 2002 11:45 am    Post subject: Reply with quote

vert wrote:

And while I'm at it, where gets the .bash_profile copied from when a new user is added?
THNX!

Code:

/etc/skel/

hth, tom
Back to top
View user's profile Send private message
klieber
Bodhisattva
Bodhisattva


Joined: 17 Apr 2002
Posts: 3657
Location: San Francisco, CA

PostPosted: Sun May 12, 2002 11:47 am    Post subject: Reply with quote

vert wrote:
I have a file called ".bash_profile" in the home dir and it says:
Code:

#This file is sourced by bash when you log in interactively.
[ -f ~/.bashrc ] && . ~/.bashrc


Do you have a .bashrc file as well? If not, that might be causing the problem. Try the following code instead:

Code:
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
    source ~/.bashrc
fi


vert wrote:
where gets the .bash_profile copied from when a new user is added?

/etc/skel

Also, I'm away from my Gentoo box at the moment, but I think there should be some bash examples in:

Code:
 /usr/share/doc/bash/examples/startup-files


Might check there to see if that's of any help.

--kurt
_________________
The problem with political jokes is that they get elected
Back to top
View user's profile Send private message
ShadowIce
n00b
n00b


Joined: 12 May 2002
Posts: 20
Location: Germany

PostPosted: Sun May 12, 2002 9:23 pm    Post subject: Reply with quote

Are you sure you are using bash as you shell? I had nearly the same problem and that was because I didn't specify a shell when adding a new user and the default was sh.
_________________
Go on, prove me wrong. Destroy the fabric of the universe. See if I care.
-- Terry Pratchett
Back to top
View user's profile Send private message
vert
Apprentice
Apprentice


Joined: 07 May 2002
Posts: 214
Location: Delft, The Netherlands

PostPosted: Sun May 12, 2002 10:14 pm    Post subject: Reply with quote

I'm pretty sure its bash. How can I check?
And I do have a .bashrc Its empty though (excep for some comments).
And still no color :(
Back to top
View user's profile Send private message
klieber
Bodhisattva
Bodhisattva


Joined: 17 Apr 2002
Posts: 3657
Location: San Francisco, CA

PostPosted: Sun May 12, 2002 11:01 pm    Post subject: Reply with quote

vert wrote:
I'm pretty sure its bash. How can I check?


Look in your /etc/passwd file and find the username in question. If it's a bash shell, you should see something like:

Code:
username:x:1000:1000:Full Name,,,:/home/username:/bin/bash


With the '/bin/bash' part being the key.

--kurt
_________________
The problem with political jokes is that they get elected
Back to top
View user's profile Send private message
FlyingCow
n00b
n00b


Joined: 11 May 2002
Posts: 2
Location: Bavaria / DE

PostPosted: Sun May 12, 2002 11:08 pm    Post subject: set bash as default shell Reply with quote

By the way ... as root, you can set the default shell with
Code:
usermod -s /bin/bash someuser
.
That way, no don't need to edit the /etc/passwd file
Back to top
View user's profile Send private message
vert
Apprentice
Apprentice


Joined: 07 May 2002
Posts: 214
Location: Delft, The Netherlands

PostPosted: Mon May 13, 2002 11:49 am    Post subject: Re: set bash as default shell Reply with quote

FlyingCow wrote:
By the way ... as root, you can set the default shell with
Code:
usermod -s /bin/bash someuser
.
That way, no don't need to edit the /etc/passwd file


I did that, so its bash all right
Other suggestions as to why the --color isn't working?
Back to top
View user's profile Send private message
fuzz
Tux's lil' helper
Tux's lil' helper


Joined: 23 Apr 2002
Posts: 93

PostPosted: Mon May 13, 2002 11:55 pm    Post subject: Reply with quote

is there a way to give the folders a diferent color other than blue
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum