diff options
author | Florian Pritz <bluewind@xssn.at> | 2009-11-29 21:55:27 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xssn.at> | 2009-11-29 21:55:27 +0100 |
commit | 9b2e622b9326c459020785a02d220618e36d20c7 (patch) | |
tree | c06b88c7a01f5263df1cece4649d493bb2013f0e | |
parent | 6b955979f1d097b8c14fe83befb4b01f661fe54c (diff) | |
download | dotfiles-9b2e622b9326c459020785a02d220618e36d20c7.tar.gz dotfiles-9b2e622b9326c459020785a02d220618e36d20c7.tar.xz |
zshrc: cleanup and [ to [[
Signed-off-by: Florian Pritz <bluewind@xssn.at>
-rw-r--r-- | .zshrc | 40 |
1 files changed, 8 insertions, 32 deletions
@@ -48,7 +48,7 @@ p_black=$'%{\e[0;37m%}' p_white=$'%{\e[1;37m%}' # colors in framebuffer! -if [ "$TERM" = "linux" ]; then +if [[ $TERM = "linux" ]]; then ${HOME}/bin/parse_xdefaults.sh clear #for background artifacting fi @@ -266,12 +266,12 @@ ctailf() { } password() { - if [ -z "$1" ]; then + if [[ -z $1 ]]; then count=8 else count="$1" fi - < /dev/urandom tr -dc A-Za-z0-9_ | head -c$count + echo $(< /dev/urandom tr -dc A-Za-z0-9_ | head -c$count) } # jump between directories @@ -348,7 +348,7 @@ yd(){ } # some script to make this damn agent work easier -if [ "x$DISPLAY" != "x" ]; then +if [[ -z $DISPLAY ]]; then source ${HOME}/bin/gpg-agent.sh fi @@ -360,12 +360,12 @@ google(){ # swaps 2 files swap() { - if [ "$1" = "" ] || [ "$2" = "" ] || [ "$1" = "-h" ]; then + if [[ -z $1 ]] || [[ -z $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 + if [[ -f $1 ]] && [[ -f $2 ]]; then local TMPFILE=tmp.$$ mv "$1" $TMPFILE mv "$2" "$1" @@ -404,32 +404,6 @@ short_ii() { echo } -# actually it converts any mp4 or flv to mp3... -youtube2mp3() { - for file in "$@" - do - if [ -f "${file}" ] ; then - title=$(echo ${file} | sed 's/\(.*\)\..*/\1/') - case $(file -b --mime-type "${file}") in - video/mp4) - faad "${file}" && - lame "${title}.wav" "${title}.mp3" && - rm "${title}.wav" - ;; - video/x-flv) - ffmpeg -i "${file}" -vn -acodec copy "${title}.mp3" - ;; - *) - echo -e "${RED}Error:$NC No rule how to convert \"${file}\"" - ;; - esac - else - echo -e "${RED}Error:$NC \"${file}\" doesn't exist" - fi - done -} - - # }}} # History {{{ export HISTFILE=~/.zsh/histfile @@ -521,6 +495,8 @@ alias install32='linux32 sudo makechrootpkg -r ~/misc/chroots/arch32 -I' alias install64='linux64 sudo makechrootpkg -r ~/misc/chroots/arch64 -I' alias clean32='sudo rm -r ~/misc/chroots/arch32/rw' alias clean64='sudo rm -r ~/misc/chroots/arch64/rw' +alias shell32='linux32 sudo mkarchroot -r bash ~/misc/chroots/arch32/root' +alias shell64='linux64 sudo mkarchroot -r bash ~/misc/chroots/arch64/root' #alias sudo="sudo " #Sudo wont recognize aliases without this alias s='sudo ' |