+snp.sh Search And Play !
This commit is contained in:
parent
a93aa73f80
commit
c06e920b5b
1 changed files with 23 additions and 0 deletions
23
bashrc.d/snp.sh
Normal file
23
bashrc.d/snp.sh
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Serch And Play !
|
||||||
|
|
||||||
|
player=qmmp
|
||||||
|
player_args=
|
||||||
|
|
||||||
|
snp() {
|
||||||
|
if [[ -n $1 ]]
|
||||||
|
then string=$1
|
||||||
|
else read -p "SEARCH: " string
|
||||||
|
fi
|
||||||
|
|
||||||
|
IFS_BAK=$IFS
|
||||||
|
IFS=$'\n'
|
||||||
|
files=()
|
||||||
|
|
||||||
|
for file in $(ls | grep -i "$string"); do
|
||||||
|
files+=("$file") # Ajoute le fichier au tableau
|
||||||
|
done
|
||||||
|
|
||||||
|
setsid $player $player_args "${files[@]}" 2>/dev/null & # Passe chaque élément séparément à qmmp
|
||||||
|
IFS=$IFS_BAK
|
||||||
|
}
|
Loading…
Reference in a new issue