You are not logged in.
I have the popular "extract" function in my .bashrc:
alias go='startx'
alias ls='ls --color=auto'
alias pacman='pacman-color'
alias sudo='sudo '
alias cp='cp -ivr'
alias mv='mv -iv'
#PS1='[\u@\h \W]\$ '
PS1='\[\e[0;32m[\]\[\e[0;37m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[0;32m\]]\[\e[0;37m\]$ \[\e[m\]\[\e[0;32m\] '
complete -cf sudo
export XTERM='urxvt'
export OOO_FORCE_DESKTOP=gnome
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
And I also have it in /root/.bashrc.
Yet, when I try to "sudo extract" something, it says extract isn't a function. (Same error as if I typed garbage into the terminal. I don't remember what the wording is)
I think it's because of my "sudo=sudo " alias, which I need for "sudo pacman" to use the pacman-color alias. How can I fix this?
Offline
I'm not sure this will work since you also have it on your /root/.bashrc, but maybe you can try a sudo -E (preserve enviroment).
Edit: sorry, I tested it, and it didn't work for me (I also put it in /root/.bashrc aswell, and don't have a sudo alias).
Last edited by lldmer (2008-08-10 20:50:59)
For lack of better words: chair, never, toothbrush, really. Ohw, and fish!
Offline
.bashrc doesnt get sourced when u use 'sudo'
either you just 'su' or try this:
http://w00tbl0g.blogspot.com/2007/05/us … -sudo.html
(i'd rather 'su' )
edit:
OR you put the extract function in a script file and put it somewhere in PATH (i.e. /usr/local/bin)
Last edited by robmaloy (2008-08-11 07:03:41)
☃ Snowman ☃
Offline
If it's just this extract you're missing check out atool.
Offline