You are not logged in.

#1 2007-06-23 05:23:06

flebber
Member
Registered: 2007-06-19
Posts: 32

.bashrc not working for pacman

Hi I was trying to get coloured output for pacman as per the wiki (Wiki Pacman Colour)I chose just to add the alias to my .bashrc method. I know that other functions of my .bashrc are working. This is my .bashrc

alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
# coloured pacman output
alias pacs="pacsearch"
pacsearch () {
       echo -e "$(pacman -Ss $@ | sed \
       -e 's#current/.*#\\033[1;31m&\\033[0;37m#g' \
       -e 's#extra/.*#\\033[0;32m&\\033[0;37m#g' \
       -e 's#community/.*#\\033[1;35m&\\033[0;37m#g' \
       -e 's#^.*/.* [0-9].*#\\033[0;36m&\\033[0;37m#g' )"
}
# safety copy, delete & colour
alias rm='rm -i'
alias cp='cp -iv'
alias mv='mv -i'
alias ..="cd .."
alias cl="clear"
alias ll="ls -lhav"
alias ls="ls -v --color=auto"
alias df="df -h"
alias du="du -hc"
alias mv="mv -iv"
alias cp="cp -v"

Any ideas on why it wont work have used gnome-terminal and xterm to test coloured output with no success.

This is the ll command alias working so I know my .bashrc is working or at least being recognised. I like the default behaviour of Pacman and wanted the colour output purely for readability.

[root@myhost flebber]# ll
total 192K
-rw-r--r--  1 flebber users  400 2007-06-22 16:04 #.bashrc#
drwx------ 31 flebber users 4.0K 2007-06-23 15:07 .
drwxrwxr-x  5 flebber root  4.0K 2007-06-21 02:35 ..
-rw-------  1 flebber users  477 2007-06-23 15:07 .ICEauthority
drwx------  2 flebber users 4.0K 2007-06-21 03:13 .Trash
-rw-------  1 flebber users    0 2007-06-21 03:15 .Xauthority
drwxr-xr-x  2 flebber users 4.0K 2007-06-22 05:31 .audacious
-rw-rw-r--  1 flebber users  763 2007-06-23 15:05 .bash_history
-rw-rw-r--  1 flebber users  510 2007-06-23 14:47 .bash_profile
-rw-rw-r--  1 flebber users  607 2007-06-23 15:05 .bashrc
drwxr-xr-x  3 flebber users 4.0K 2007-06-21 13:59 .cache
drwxrwxr-x  6 flebber root  4.0K 2007-06-22 05:27 .config
drwxrwxr-x  3 flebber users 4.0K 2007-06-21 00:37 .dbus
-rw-------  1 flebber users   45 2007-06-22 16:17 .dmrc
drwxr-xr-x  3 flebber users 4.0K 2007-06-22 15:30 .emacs.d
-rw-------  1 flebber users   16 2007-06-21 04:00 .esd_auth
drwxr-xr-x  3 flebber users 4.0K 2007-06-21 03:47 .evolution
drwxr-xr-x  5 flebber users 4.0K 2007-06-21 08:32 .exaile
drwx------  4 flebber users 4.0K 2007-06-22 15:33 .flock
drwxr-xr-x  5 flebber users 4.0K 2007-06-22 16:23 .fluxbox
drwxrwxr-x  2 flebber users 4.0K 2007-06-21 07:58 .fontconfig
drwxrwxr-x  5 flebber users 4.0K 2007-06-23 15:07 .gconf
drwxrwxr-x  2 flebber users 4.0K 2007-06-23 15:07 .gconfd
-rw-rw-r--  1 flebber users    0 2007-06-22 05:19 .gksu.lock
drwxrwxr-x  3 flebber users 4.0K 2007-06-21 00:37 .gnome
drwxrwxr-x  9 flebber users 4.0K 2007-06-23 15:06 .gnome2
drwx------  2 flebber users 4.0K 2007-06-21 00:37 .gnome2_private
drwxrwxr-x  2 flebber users 4.0K 2007-06-21 08:39 .gstreamer-0.10
-rw-rw-r--  1 flebber users   89 2007-06-21 00:37 .gtkrc-1.2-gnome2
drwxrwxr-x  2 flebber users 4.0K 2007-06-21 00:40 .icons
drwxr-xr-x  4 flebber users 4.0K 2007-06-21 09:02 .listen
drwxrwxr-x  3 flebber users 4.0K 2007-06-21 01:32 .local
drwxr-xr-x  2 flebber users 4.0K 2007-06-21 08:39 .lyrics
drwx------  3 flebber users 4.0K 2007-06-22 15:33 .macromedia
drwxrwxr-x  3 flebber users 4.0K 2007-06-21 00:37 .metacity
drwxrwxr-x  2 flebber users 4.0K 2007-06-22 15:33 .mozilla
drwxrwxr-x  3 flebber users 4.0K 2007-06-23 15:06 .nautilus
-rw-r--r--  1 flebber users 3.2K 2007-06-22 05:29 .recently-used.xbel
drwxrwxr-x  2 flebber users 4.0K 2007-06-21 00:40 .themes
drwx------  3 flebber users 4.0K 2007-06-21 02:26 .thumbnails
-rw-rw-r--  1 flebber   501  262 2007-06-21 00:34 .xinitrc
-rw-rw-r--  1 flebber root     9 2007-06-19 23:33 .xintrc
drwxr-xr-x  2 flebber users 4.0K 2007-06-22 05:26 .xmms
-rwxrwxr-x  1 flebber users  100 2007-06-19 21:05 .xsession
-rw-r--r--  1 flebber users  644 2007-06-23 15:07 .xsession-errors
drwxrwxr-x  2 flebber users 4.0K 2007-06-22 05:17 Desktop
-rw-r--r--  1 flebber users 3.5K 2007-06-22 05:30 eq.preset
-rw-rw-r--  1 flebber root    47 2007-06-20 08:54 hopeless
-rw-r--r--  1 flebber users 3.5K 2007-06-22 05:17 presets.gz
-rw-r--r--  1 flebber users  872 2007-06-22 05:18 winamp_presets.gz
[root@myhost flebber]#

PS this output featured colour.

Last edited by flebber (2007-06-23 05:24:51)

Offline

#2 2007-06-23 06:02:31

nikron
Member
Registered: 2007-05-15
Posts: 130

Re: .bashrc not working for pacman

You did start a new shell, right?

Offline

#3 2007-06-23 06:20:08

flebber
Member
Registered: 2007-06-19
Posts: 32

Re: .bashrc not working for pacman

yeah logged out and in

Updated

alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# coloured pacman output
alias pacs="pacsearch"
pacsearch () {
       echo -e "$(pacman -Ss $@ | sed \
       -e 's#current/.*#\\033[1;31m&\\033[0;37m#g' \
       -e 's#extra/.*#\\033[0;32m&\\033[0;37m#g' \
       -e 's#community/.*#\\033[1;35m&\\033[0;37m#g' \
       -e 's#^.*/.* [0-9].*#\\033[0;36m&\\033[0;37m#g' )"
}
# safety copy, delete & colour
alias rm='rm -i'
alias cp='cp -iv'
alias mv='mv -i'
alias ..="cd .."
alias cl="clear"
alias ll="ls -lhav"
alias ls="ls -v --color=auto"
alias df="df -h"
alias du="du -hc"
alias mv="mv -iv"
alias cp="cp -v"

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
PATH=$PATH:/home/flebber/*

Last edited by flebber (2007-06-23 06:53:43)

Offline

#4 2007-06-23 10:46:36

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: .bashrc not working for pacman

what's the difference between both bashrc ?
anyway, I copy/pasted the pacsearch from the first, and it works perfectly here..
I also find pacman -Ss to be pretty unreadable, this nice hack indeed helps smile


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#5 2007-06-23 10:54:22

flebber
Member
Registered: 2007-06-19
Posts: 32

Re: .bashrc not working for pacman

Yeah I wish the hack would work for me, but it just doesn't not sure why all other alias's work except that one. The difference between the 2 is this - it was on the whim that "discovery' of the hack was the problem it was having.

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

Offline

#6 2007-06-23 13:03:25

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: .bashrc not working for pacman

flebber wrote:

Yeah I wish the hack would work for me, but it just doesn't not sure why all other alias's work except that one. The difference between the 2 is this - it was on the whim that "discovery' of the hack was the problem it was having.

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

Doesn't this make an infinite loop ?

Anyway, are you using bash, both as root and as user ?
Are you trying as root or as user ? And did you put the alias in the correct .bashrc ?
(you don't need to be root for searching, it's read only).


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

Board footer

Powered by FluxBB