diff options
| author | moehm | 2014-04-28 11:09:35 +0200 |
|---|---|---|
| committer | moehm | 2014-04-28 11:09:35 +0200 |
| commit | c8809f9a5764d24e120f7b64867e733cfaa25b07 (patch) | |
| tree | d26cd05d710d9e3b644cecefd68e0280468b0a5b | |
| parent | 9e83822613ff11520a5470f784ad07436dae4fae (diff) | |
| parent | 09c97f22ecbcbdf152308c60c79e0f9fea5e63e3 (diff) | |
| download | dotfiles-c8809f9a5764d24e120f7b64867e733cfaa25b07.tar.gz | |
merge conflict
| -rwxr-xr-x[-rw-r--r--] | bin/dirhistory.sh | 7 | ||||
| -rwxr-xr-x | bin/play | 106 | ||||
| -rw-r--r-- | vim/.vimrc | 4 | ||||
| -rw-r--r-- | zsh/.zsh_aliases | 1 | ||||
| -rw-r--r-- | zsh/.zsh_prog | 25 | ||||
| -rw-r--r-- | zsh/.zshrc | 8 |
6 files changed, 104 insertions, 47 deletions
diff --git a/bin/dirhistory.sh b/bin/dirhistory.sh index cc652d2..06e82c2 100644..100755 --- a/bin/dirhistory.sh +++ b/bin/dirhistory.sh @@ -1,2 +1,7 @@ #!/bin/zsh -for ((i=1; i<=$DIRSTACKSIZE; i++)) echo "$i $dirstack[$i]" + +echo "Printing directory stack: " +for ((i=1; i<$DIRSTACKSIZE; i++)) +do + echo "$i $dirstack[$i]" +done @@ -11,12 +11,13 @@ printhelp(){ echo "Bash script to play and cache files from a slow network ressource" echo "" - echo "-y move to archiv without question" - echo "-n don't ask for moving" - echo "-o ask for a different archiv" - echo "-r only remove the file in /tmp" - echo "-d don't ask for downloading" - echo "-h prints this help" + echo " -d only remove the file in /tmp" + echo " -g don't ask for downloading" + echo " -h prints this help" + echo " -n don't ask for moving" + echo " -y move to archiv without question" + echo " -o ask for a different archiv" + echo " -no-cache Not caching the file, instead play's directly" exit 0 } @@ -54,6 +55,16 @@ if [ $# -eq 0 ]; then printhelp fi +if [ $# -gt 1 ]; then + echo "Do not commit more than one file." + exit 1 +fi + +if [ ! -f "$1" ]; then + echo "No valid file input." + exit +fi + player[0]=$(command -v mpv) #media player of choice player[1]=$(command -v mplayer) player[2]=$(command -v vlc) #you shouldn't use vlc @@ -101,7 +112,7 @@ if [ $cache -gt 0 ]; then wget -q -O "file" "$@" & echo "Starting download. Ready to play in 2 sec." sleep 2 - mpv file + mpv $file echo "TODO: Moving to archiv. Not implemented yet." exit 0 elif [[ $player =~ mpv$ ]] && [ $download ] && ( [ ! $download = "n" ] && [ ! $download = "N" ] && [ ! $download = "no" ] && [ ! $download = "nein" ] && [ ! $download = "NO" ]); then @@ -119,16 +130,23 @@ if [ $cache -gt 0 ]; then exit 1 fi else - cp "$@" "$tmp" & + file=$(basename "$@") + if [ -f "$tmp/$file" ]; then + skip=true + fi + cp -u -i "$@" "$tmp" & cd "$tmp" - file=${@##*/} - - echo -n "Preparing the awesome! Starting playback in.." - echo -n " 2," - sleep 1 - echo -n " 1" - sleep 1 - echo " Start!" + #file=${@##*/} + + if [ ! $skip ]; then + echo -n "Preparing the awesome! Starting playback in.." + echo -n " 2," + sleep 1 + echo -n " 1 " + sleep 1 + fi + + echo "Start!" fi else echo -n "Preparing the awesome! Starting playback in.." @@ -138,44 +156,40 @@ fi $player "$file" if [ $? -eq 0 ]; then - if [ $cache -gt 0 ]; then - if [ -d $ARCHIV ] && [ -w $ARCHIV ] && [ $ARCHIV ]; then - echo "Finished $file succesfull." - if [ ! $verify ]; then - read -p "Should we move everything to the archiv? ($ARCHIV) [Y/n/rm/other] " verify + if [ -d $ARCHIV ] && [ -w $ARCHIV ] && [ $ARCHIV ]; then + echo "Finished $file succesfull." + if [ ! $verify ]; then + read -p "Should we move everything to the archiv? ($ARCHIV) [Y/n/rm/other] " verify + fi + if [ ! $verify ] || [ $verify = "ja" ] || [ $verify = "yes" ] || [ $verify = "j" ] || [ $verify = "y" ] || [ $verify = "Y" ]; then + echo "Moving the stuff to $ARCHIV." + mv -v "$file" "$ARCHIV" + if [ $? -eq 0 ]; then + cd "$pwd" + rm -v "$@" fi - if [ ! $verify ] || [ $verify = "ja" ] || [ $verify = "yes" ] || [ $verify = "j" ] || [ $verify = "y" ] || [ $verify = "Y" ]; then - echo "Moving the stuff to $ARCHIV." - mv -v "$file" "$ARCHIV" + elif [ $verify = "other" ] || [ $verify = "o" ] || [ $verify = "O" ] || [ $verify = "OTHER" ]; then + read -p "Please tell us the absolute path: " path + if [ -d $path ] && [ -w $path ]; then + echo "Moving to $path." + mv -v "$file" "$path" if [ $? -eq 0 ]; then cd "$pwd" - rm -v "$@" - fi - elif [ $verify = "other" ] || [ $verify = "o" ] || [ $verify = "O" ] || [ $verify = "OTHER" ]; then - read -p "Please tell us the absolute path: " path - if [ -d $path ] && [ -w $path ]; then - echo "Moving to $path." - mv -v "$file" "$path" - if [ $? -eq 0 ]; then - cd "$pwd" - rm -v "$@" - fi - else - echo "Sorry, \"$path\" doesn't exist." - exit 1 - fi - elif [ $verify = "r" ] || [ $verify = "rm" ] || [ $verify = "remove" ] || [ $verify = "RM" ] || [ $verify = "R" ]; then - echo "Cleaning the mess up. Only removing files from $tmp." - rm -v "$file" + rm -v "$@" + fi else - echo "Okay, don't touching the files." + echo "Sorry, \"$path\" doesn't exist." + exit 1 fi + elif [ $verify = "r" ] || [ $verify = "rm" ] || [ $verify = "remove" ] || [ $verify = "RM" ] || [ $verify = "R" ]; then + echo "Cleaning the mess up. Only removing files from $tmp." + rm -v "$file" else - echo "Can't move to \"$ARCHIV\". Directory doesn't exist or you don't have write permission." - exit 1 + echo "Okay, don't touching the files." fi else - echo "Nothing was cached, nothing is touched." + echo "Can't move to \"$ARCHIV\". Directory doesn't exist or you don't have write permission." + exit 1 fi else echo "Something is broken with the media player!" @@ -13,3 +13,7 @@ syntax enable set encoding=utf8 "map! jj <ESC> +command W w +command Q q +command WQ wq +command Wq wq diff --git a/zsh/.zsh_aliases b/zsh/.zsh_aliases index e20d391..a330ec7 100644 --- a/zsh/.zsh_aliases +++ b/zsh/.zsh_aliases @@ -17,3 +17,4 @@ alias du='du -h' alias down='sudo shutdown -hP now' alias df='df -h' alias dus='du -s' +alias lll='ls -lisa' diff --git a/zsh/.zsh_prog b/zsh/.zsh_prog new file mode 100644 index 0000000..51f63f5 --- /dev/null +++ b/zsh/.zsh_prog @@ -0,0 +1,25 @@ +ex () +{ + 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 ex()" ;; + esac + else + echo "'$1' is not a valid file" + fi +} + +calc(){ + echo "scale=3;$@" | bc -l +} @@ -3325,3 +3325,11 @@ fi if [ -f ~/.zsh_dirstack ]; then . ~/.zsh_dirstack fi + +if [ -f ~/.zsh_prog ]; then + . ~/.zsh_prog +fi + +if [ -f ~/.zshrc_orig ]; then + . ~/.zshrc_orig +fi |
