Saturday, June 21

Neato .bashrc functions

Saw these three functions in this thread on the Arch Linux forum and thought they were neat. Since I'm on the parents' computer I thought I'd stick them here for the next time I'm on my eee (which is happily running Arch) or for when someone is googling about for .bashrc stuff :).


# from user semperfiguy's .bashrc
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar 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
}

# from user kaKTuZ's .bashrc
function remindme()
{
sleep $1 && zenity --info --text "$2" &
}

# from uer Daenyth's .bashrc
function weather ()
{
links -dump "http://google.com/search?q=weather+${1:-02135}"
| grep -A 5 -m 1 '^ *Weather for' | grep -v 'Add to'
}

Labels: , , , , ,

1 Comments:

Anonymous Daenyth said...

Nifty :P

I've got some more in my github.

8:16 PM  

Post a Comment

<< Home