bin: do not call any variable 'path'
That somehow overrides the PATH variable upon copying out...
This commit is contained in:
parent
10819be48c
commit
8af2f94cbe
|
@ -226,7 +226,7 @@ alias grpc='grep --color=auto --line-number --binary-files=without-match --direc
|
||||||
# Grep recursively and paginate
|
# Grep recursively and paginate
|
||||||
grpr() { grp --color=always --recursive $(echo $DIRS_IGNORE | sed 's/-x/--exclude-dir/g') "$@" | less -F; }
|
grpr() { grp --color=always --recursive $(echo $DIRS_IGNORE | sed 's/-x/--exclude-dir/g') "$@" | less -F; }
|
||||||
# Grep in shell config files
|
# Grep in shell config files
|
||||||
grsh() { grpr "$@" $HOME/.{ba,z}sh* $HOME/.local/bin $CONFIG_SHELLS $CONFIG_ZSH }
|
grsh() { grpr --no-ignore-case "$@" $HOME/.{ba,z}sh* $HOME/.local/bin $CONFIG_SHELLS $CONFIG_ZSH }
|
||||||
|
|
||||||
# Recover stray swap files from neovim
|
# Recover stray swap files from neovim
|
||||||
alias vrec="ls $XDG_DATA_HOME/nvim/swap | sed 's/\%/\//g' | sed 's|\(.*\)\..*|\1|' | head -1 | xargs --no-run-if-empty nvim"
|
alias vrec="ls $XDG_DATA_HOME/nvim/swap | sed 's/\%/\//g' | sed 's|\(.*\)\..*|\1|' | head -1 | xargs --no-run-if-empty nvim"
|
||||||
|
|
|
@ -14,8 +14,8 @@ df --output="source,avail" -h $(test -n "$local" && echo ".") "$dir"
|
||||||
|
|
||||||
highlight "cleaning home"
|
highlight "cleaning home"
|
||||||
for f in ${_clean_home[@]}
|
for f in ${_clean_home[@]}
|
||||||
do path="$dir/$f"
|
do file="$dir/$f"
|
||||||
test -f "$path" || test -d "$path" && echo "Removing superfluous $path" && rm -rf $i "$path"
|
test -f "$file" || test -d "$file" && echo "Removing superfluous $file" && rm -rf $i "$file"
|
||||||
done
|
done
|
||||||
find "$dir" -maxdepth 2 -not -name ".stfolder" -empty -printf "Removing empty %p\n" -delete
|
find "$dir" -maxdepth 2 -not -name ".stfolder" -empty -printf "Removing empty %p\n" -delete
|
||||||
find -L -maxdepth 2 -type l -printf "Removing broken symlink %p\n" -delete
|
find -L -maxdepth 2 -type l -printf "Removing broken symlink %p\n" -delete
|
||||||
|
@ -37,7 +37,8 @@ highlight "s :: recursively remove logs"
|
||||||
|
|
||||||
highlight "m :: recursively remove mac-files"
|
highlight "m :: recursively remove mac-files"
|
||||||
if [[ $1 =~ "m" ]]; then
|
if [[ $1 =~ "m" ]]; then
|
||||||
find -iname '.spotlight*' -exec rm -rI {} +
|
find -name '__MACOSX' -print -exec rm -r {} +
|
||||||
|
find -iname '.spotlight*' -print -exec rm -rI {} +
|
||||||
find -name '*.DS_Store' -delete
|
find -name '*.DS_Store' -delete
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# optdepends: rewrite(part of my dotfiles)
|
# optdepends: rewrite(part of my dotfiles)
|
||||||
for arg do
|
for arg do
|
||||||
if test -r "$arg"; then
|
if test -r "$arg"; then
|
||||||
path="$(realpath "$arg")"
|
fullpath="$(realpath "$arg")"
|
||||||
name="$(basename "${path%.*}")"
|
name="$(basename "${path%.*}")"
|
||||||
namepart="$name.part"
|
namepart="$name.part"
|
||||||
(
|
(
|
||||||
|
@ -16,20 +16,20 @@ for arg do
|
||||||
fi
|
fi
|
||||||
echo "Extracting $arg into $PWD"
|
echo "Extracting $arg into $PWD"
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
(*.tar.*|*.tar) tar --extract --file "$path";;
|
(*.tar.*|*.tar) tar --extract --file "$fullpath";;
|
||||||
(*.tbz2) tar xjf "$path" ;;
|
(*.tbz2) tar xjf "$fullpath" ;;
|
||||||
(*.tgz) tar xzf "$path" ;;
|
(*.tgz) tar xzf "$fullpath" ;;
|
||||||
(*.7z|*.z01|*.zip|*.jar)
|
(*.7z|*.z01|*.zip|*.jar)
|
||||||
if which 7z >/dev/null
|
if which 7z >/dev/null
|
||||||
then 7z x "$path"
|
then 7z x "$fullpath"
|
||||||
else unzip "$path" | rewrite
|
else unzip "$fullpath" | rewrite
|
||||||
fi;;
|
fi;;
|
||||||
(*.gz) gunzip "$path" ;;
|
(*.gz) gunzip "$fullpath" ;;
|
||||||
(*.bz2) bunzip2 "$path" ;;
|
(*.bz2) bunzip2 "$fullpath" ;;
|
||||||
(*.rar) unrar x "$path" ;;
|
(*.rar) unrar x "$fullpath" ;;
|
||||||
(*.deb) ar x "$path" ;;
|
(*.deb) ar x "$fullpath" ;;
|
||||||
(*.zst) unzstd "$path" ;;
|
(*.zst) unzstd "$fullpath" ;;
|
||||||
(*.Z) uncompress "$path";;
|
(*.Z) uncompress "$fullpath";;
|
||||||
(*) echo "'$arg' cannot be extracted by ex" >&2;;
|
(*) echo "'$arg' cannot be extracted by ex" >&2;;
|
||||||
esac
|
esac
|
||||||
test "$(basename "$PWD")" = "$namepart" &&
|
test "$(basename "$PWD")" = "$namepart" &&
|
||||||
|
|
|
@ -9,22 +9,23 @@ if test "$1" = "-r"
|
||||||
then shift
|
then shift
|
||||||
test "$1" = "-v" && verbose=-v && shift
|
test "$1" = "-v" && verbose=-v && shift
|
||||||
for arg
|
for arg
|
||||||
do path="$({ find "$(dirname "$arg")" -maxdepth 1 -name "$(basename "$arg")*" -exec realpath {} + ||
|
do filepath="$({ find "$(dirname "$arg")" -maxdepth 1 -name "$(basename "$arg")*" -exec realpath {} + ||
|
||||||
find "$MUSIC/$(dirname "$arg")" "$MUSIC/Playlists/$(dirname "$arg")" -maxdepth 1 \
|
find "$MUSIC/$(dirname "$arg")" "$MUSIC/Playlists/$(dirname "$arg")" -maxdepth 1 \
|
||||||
-name "$(basename "$arg")*" -exec realpath {} +; } 2>/dev/null)"
|
-name "$(basename "$arg")*" -exec realpath {} +; } 2>/dev/null)"
|
||||||
test -n "$verbose" && echo "Scanning path '$path' $(
|
test -n "$verbose" && echo "Scanning path '$filepath' $(
|
||||||
test "$arg" != "$path" && echo "from '$arg' ")(MUSIC: '$MUSIC', PWD: '$PWD')" >&2
|
test "$arg" != "$filepath" && echo "from '$arg' ")(MUSIC: '$MUSIC', PWD: '$PWD')" >&2
|
||||||
test $(printf "$path" | wc -l) -gt 0 && printf "$path" | xargs --delim='\n' "$0" -r $verbose && continue
|
test $(printf "$filepath" | wc -l) -gt 0 && printf "$filepath" | xargs --delim='\n' "$0" -r $verbose && continue
|
||||||
test -n "$path" || continue
|
test -n "$filepath" || continue
|
||||||
if { file "$path" | grep -i ' playlist' || expr "$path" : ".*\.m3u8\?$"; } >/dev/null
|
if { file "$filepath" | grep -i ' playlist' || expr "$filepath" : ".*\.m3u8\?$"; } >/dev/null
|
||||||
then pushd "$(dirname "$path")" >/dev/null &&
|
then pushd "$(dirname "$filepath")" >/dev/null &&
|
||||||
cat "$path" | sed '/#.*/D' | xargs --delim='\n' "$0" -r $verbose &&
|
cat "$filepath" | sed '/#.*/D' | xargs --delim='\n' "$0" -r $verbose &&
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
else
|
else
|
||||||
test -n "$verbose" &&
|
test -n "$verbose" &&
|
||||||
echo "Running find in path '$path' $(test "$arg" != "$path" && echo "from '$arg' ")(MUSIC: '$MUSIC', PWD: '$PWD')" >&2
|
echo "Running find in path '$filepath' $(test "$arg" != "$filepath" && echo "from '$arg' ")(MUSIC: '$MUSIC', PWD: '$PWD')" >&2
|
||||||
find "$path" -iname "*.flac" -o -iname "*.mp3" -o -iname "*.ogg" -o -iname "*.opus" | sort | while read file
|
find "$filepath" -iname "*.flac" -o -iname "*.mp3" -o -iname "*.ogg" -o -iname "*.opus" |
|
||||||
do case "$path" in
|
sort | while read file
|
||||||
|
do case "$filepath" in
|
||||||
($MUSIC/*) echo "${file#$MUSIC/}";;
|
($MUSIC/*) echo "${file#$MUSIC/}";;
|
||||||
(*) mkdir -p "$LINKS" &&
|
(*) mkdir -p "$LINKS" &&
|
||||||
ln -fs "$file" "$LINKS/$(basename "$file")" &&
|
ln -fs "$file" "$LINKS/$(basename "$file")" &&
|
||||||
|
@ -36,7 +37,7 @@ else
|
||||||
test "$1" = "-q" && quiet=-q && shift
|
test "$1" = "-q" && quiet=-q && shift
|
||||||
test -n "$(mpc playlist)" && next=-q
|
test -n "$(mpc playlist)" && next=-q
|
||||||
test "$1" = "--seek" && seek=-q
|
test "$1" = "--seek" && seek=-q
|
||||||
{ "$0" -r "$@" && mpc -q update --wait; } | #tee /tmp/mp 2>&1
|
( "$0" -r "$@" && mpc -q update --wait ) | #tee /tmp/mp 2>&1
|
||||||
xargs --delim='\n' mpc insert
|
xargs --delim='\n' mpc insert
|
||||||
mpc ${quiet:-${next:-$seek}} play
|
mpc ${quiet:-${next:-$seek}} play
|
||||||
test -z "$next" || mpc ${quiet:-$seek} next
|
test -z "$next" || mpc ${quiet:-$seek} next
|
||||||
|
|
Loading…
Reference in New Issue