+snp.sh Search And Play !

This commit is contained in:
T0MuX 2025-06-07 07:36:39 +02:00
parent a93aa73f80
commit c06e920b5b

23
bashrc.d/snp.sh Normal file
View 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
}