config/shell: Make functions safer & add arch

This commit is contained in:
xerus2000 2020-10-12 22:20:06 +02:00
parent 2d7d0c1fd7
commit fbf33e6eef
4 changed files with 13 additions and 6 deletions

8
.config/shell/arch Normal file
View File

@ -0,0 +1,8 @@
which pacman >/dev/null || return
# Arch aliases
alias pac='sudo pacman'
alias pacs='pac -Syu --needed'
alias pacr='pac -R'
alias yays='yay -Syu --needed'

View File

@ -287,7 +287,7 @@ mvk() {
mv "$1" "$2"
}
# Moves from $1 to $2 and creates a symlink in place of $2
# Moves from $1 to $2 and replaces the original with a relative symlink
mvln() {
file=$(test -f "$1" && echo 1 || echo 0)
if test -d $1; then
@ -297,7 +297,7 @@ mvln() {
mv -v $1 $2
fi
[ $file -gt 0 -a -d $2 ] && 2="$2/$(basename $1)"
ln -vsr $2 $1
ln -vsr "$2" "$1"
}
# OTHER

View File

@ -1,5 +1,6 @@
MUSIC="$HOME/daten/music"
AUDIO="$HOME/daten/audio"
export DATA="$(test -d $HOME/data && echo $HOME/data || $HOME/daten)"
export MUSIC="$DATA/music"
export AUDIO="$DATA/audio"
MUSIC_RAW="$AUDIO/songs/_raw"
edpl() {

View File

@ -1,5 +1,3 @@
#!/bin/sh
MUSIC="$HOME/daten/music"
playlistPath="$MUSIC/Playlists"
result="$(test "$1" && (find $playlistPath -iname "focus-$1.m3u8" | grep . || find $playlistPath -iname "$1.m3u*" | grep . || find $MUSIC -iname "*$1*") || echo "$playlistPath/focus.m3u8" )"
vp "$result"