bin: little corrections

This commit is contained in:
xeruf 2021-09-20 08:57:20 +02:00
parent d310686e63
commit f8d4fc9b4c
4 changed files with 7 additions and 5 deletions

View File

@ -5,18 +5,16 @@ for arg do
if test -r "$arg"; then if test -r "$arg"; then
case "$arg" in case "$arg" in
*.tar.bz2) tar xjf "$arg" ;; *.tar.bz2) tar xjf "$arg" ;;
*.tar.gz) tar xzf "$arg" ;; *.tar.*|*.tar) tar --extract --file "$arg";;
*.bz2) bunzip2 "$arg" ;; *.bz2) bunzip2 "$arg" ;;
*.rar) unrar x "$arg" ;; *.rar) unrar x "$arg" ;;
*.gz) gunzip "$arg" ;; *.gz) gunzip "$arg" ;;
*.tar) tar xf "$arg" ;;
*.tbz2) tar xjf "$arg" ;; *.tbz2) tar xjf "$arg" ;;
*.tgz) tar xzf "$arg" ;; *.tgz) tar xzf "$arg" ;;
*.zip|*.jar) unzip "$arg" ;; *.zip|*.jar) unzip "$arg" ;;
*.Z) uncompress "$arg";; *.Z) uncompress "$arg";;
*.7z) 7z x "$arg" ;; *.7z) 7z x "$arg" ;;
*.deb) ar x "$arg" ;; *.deb) ar x "$arg" ;;
*.tar.xz) tar xf "$arg" ;;
*.zst) unzstd "$arg" ;; *.zst) unzstd "$arg" ;;
*) echo "'$arg' cannot be extracted by ex" ;; *) echo "'$arg' cannot be extracted by ex" ;;
esac esac

View File

@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh -e
# set repo as origin and set all branches upstream to a corresponding remote branch, if available # set repo as origin and set all branches upstream to a corresponding remote branch, if available
git remote remove origin 2>/dev/null git remote remove origin 2>/dev/null
git remote add origin $(git-repo "$@") git remote add origin $(git-repo "$@")
git remote -v && git fetch || ( last=$? && echo "git fetch failed, aborting\!" && return $last ) git remote -v && git fetch
git branch | sed 's/ //g' | sed 's/*//' | while read branch git branch | sed 's/ //g' | sed 's/*//' | while read branch
do test $(git branch -a | grep origin/$branch | wc -l) -gt 0 && git branch -u origin/$branch $branch do test $(git branch -a | grep origin/$branch | wc -l) -gt 0 && git branch -u origin/$branch $branch

3
.local/bin/scripts/grpf Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
# Grep in files matching the name pattern given as first argument
find -name "$1" | while read f; do grep --color=always --line-number --ignore-case -H "${@:2}" "$f"; done | less -F

View File

@ -9,5 +9,6 @@ case $1 in
info --vi-keys $(test $search != zsh && echo --index-search=$search) zsh || LESS="$LESS +/^ *${@:$#} *\\[" man zshall;; info --vi-keys $(test $search != zsh && echo --index-search=$search) zsh || LESS="$LESS +/^ *${@:$#} *\\[" man zshall;;
(vlc) unbuffer vlc --full-help "${@:2}" | $paginate;; (vlc) unbuffer vlc --full-help "${@:2}" | $paginate;;
(gh|chordpro) $@ --help | $paginate;; (gh|chordpro) $@ --help | $paginate;;
(caddy) $1 help ${@:2} | $paginate;;
(*) info "$1" -w | grep -v "manpages" && pinfo "$@" || man "$@" || ( "$@" --help || "$@" -help ) 2>&1 | $paginate;; (*) info "$1" -w | grep -v "manpages" && pinfo "$@" || man "$@" || ( "$@" --help || "$@" -help ) 2>&1 | $paginate;;
esac esac