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" 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() { mvln() {
file=$(test -f "$1" && echo 1 || echo 0) file=$(test -f "$1" && echo 1 || echo 0)
if test -d $1; then if test -d $1; then
@ -297,7 +297,7 @@ mvln() {
mv -v $1 $2 mv -v $1 $2
fi fi
[ $file -gt 0 -a -d $2 ] && 2="$2/$(basename $1)" [ $file -gt 0 -a -d $2 ] && 2="$2/$(basename $1)"
ln -vsr $2 $1 ln -vsr "$2" "$1"
} }
# OTHER # OTHER

View File

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

View File

@ -1,5 +1,3 @@
#!/bin/sh
MUSIC="$HOME/daten/music"
playlistPath="$MUSIC/Playlists" 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" )" 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" vp "$result"