diff options
author | Florian Pritz <f-p@gmx.at> | 2009-02-24 19:21:13 +0100 |
---|---|---|
committer | Florian Pritz <f-p@gmx.at> | 2009-02-24 19:21:13 +0100 |
commit | 84e1a45e61ea77896725dacebc2e1f6a22091a94 (patch) | |
tree | f13dee125a105c94d55569d7d9fc89cd2c6605c2 /.zsh/rc | |
parent | 710bac948e5f471f1b8960f746aa19c8c1d29734 (diff) | |
download | dotfiles-84e1a45e61ea77896725dacebc2e1f6a22091a94.tar.gz dotfiles-84e1a45e61ea77896725dacebc2e1f6a22091a94.tar.xz |
removed function keywords and normalized indentation
Diffstat (limited to '.zsh/rc')
-rw-r--r-- | .zsh/rc/30functions | 81 |
1 files changed, 38 insertions, 43 deletions
diff --git a/.zsh/rc/30functions b/.zsh/rc/30functions index 9427bfe..b7d0493 100644 --- a/.zsh/rc/30functions +++ b/.zsh/rc/30functions @@ -1,14 +1,14 @@ #-------------------- -# Functions +# Functions #-------------------- # always /etc/rc.d/blub is a bit too much work ;) -rc () { +rc() { sudo /etc/rc.d/$1 $2 } # usefull if you have more machines and want to easily update the config here -update_zshrc () { +update_zshrc() { old_pwd="$PWD" builtin cd "$HOME/.zsh" wget http://flo.server-speed.net/stuff/dotfiles/zshrc -O $HOME/.zshrc @@ -37,7 +37,7 @@ ls () { echo "${PURPLE}Files: ${BLUE}$(/bin/ls -l $@ | grep -v "^[l|d|total]" | wc -l) ${GREEN}--- ${PURPLE}Directories: ${BLUE}$(/bin/ls -l $@ | grep "^d" | wc -l)${NC}" } -password () { +password() { if [ -z "$1" ]; then count=8 else @@ -114,7 +114,7 @@ hglob() { } # download any package's PKGBUILD and go into that dir -yd (){ +yd(){ if [ -n "$1" ]; then mkdir -p $1 builtin cd $1 @@ -134,35 +134,32 @@ google(){ } # swaps 2 files -function swap() -{ - if [ "$1" = "" ] || [ "$2" = "" ] || [ "$1" = "-h" ]; then - echo -e "${blue}Usage:$NC swap <file> <file>"; - echo -e "Swaps files"; - return 1 - fi - if [ -f $1 ] && [ -f $2 ]; then - local TMPFILE=tmp.$$ - mv "$1" $TMPFILE - mv "$2" "$1" - mv $TMPFILE "$2" - else - echo -e "${RED}Error:$NC One or more files don't exist" - return 1 - fi +swap() { + if [ "$1" = "" ] || [ "$2" = "" ] || [ "$1" = "-h" ]; then + echo -e "${blue}Usage:$NC swap <file> <file>"; + echo -e "Swaps files"; + return 1 + fi + if [ -f $1 ] && [ -f $2 ]; then + local TMPFILE=tmp.$$ + mv "$1" $TMPFILE + mv "$2" "$1" + mv $TMPFILE "$2" + else + echo -e "${RED}Error:$NC One or more files don't exist" + return 1 + fi } # get your internal and external IPs # also found somewhere on the net -function my_ip() -{ - MY_IP=$(/sbin/ifconfig eth0 | awk '/inet/ { print $2 } ' | \ - sed -e s/addr://) - MY_ISP=$(curl www.wieistmeineip.de | awk '(/[0-9]?[0-9]?[0-9]\.[0-9]?[0-9]?[0-9]\.[0-9]?[0-9]?[0-9]\.[0-9]?[0-9]?[0-9]/) {print}' | awk 'gsub(/[>||<]/," ")' | awk '{print $3}') +my_ip() { + MY_IP=$(/sbin/ifconfig eth0 | awk '/inet/ { print $2 } ' | \ + sed -e s/addr://) + MY_ISP=$(curl www.wieistmeineip.de | awk '(/[0-9]?[0-9]?[0-9]\.[0-9]?[0-9]?[0-9]\.[0-9]?[0-9]?[0-9]\.[0-9]?[0-9]?[0-9]/) {print}' | awk 'gsub(/[>||<]/," ")' | awk '{print $3}') } -function ii() -{ +ii() { echo -e "\nUser ${RED}"${USER:-"N/A"}"$NC on "${RED}${HOST:-"N/A"}"$NC" echo -e "\n${RED}Additionnal information:$NC " ; uname -a echo -e "\n${RED}Users logged on:$NC " ; w -h @@ -176,29 +173,27 @@ function ii() } # short info to display when opening a new shell -function short_ii() -{ +short_ii() { echo -e "\nUser ${RED}"${USER:-"N/A"}"$NC on "${RED}${HOST:-"N/A"}"$NC" echo -e "\n${RED}Machine stats:$NC " ; uptime echo } -function repeat() -{ - if [ "$1" = "" ] || [ "$2" = "" ] || [ "$1" = "-h" ]; then - echo -e "${blue}Usage:$NC repeat <number> <command>"; - echo -e "Repeats a command"; - return 1 - fi - local i max - max=$1; shift; - for ((i=1; i <= max ; i++)); do - eval "$@"; - done +repeat() { + if [ "$1" = "" ] || [ "$2" = "" ] || [ "$1" = "-h" ]; then + echo -e "${blue}Usage:$NC repeat <number> <command>"; + echo -e "Repeats a command"; + return 1 + fi + local i max + max=$1; shift; + for ((i=1; i <= max ; i++)); do + eval "$@"; + done } # actually it converts any mp4 or flv to mp3... -youtube2mp3 () { +youtube2mp3() { for file in "$@" do if [ -f ${file} ] ; then |