fgrep is 0.00001% faster and safer.

This commit is contained in:
Emre AKYÜZ 2023-11-10 09:55:38 +03:00 committed by GitHub
parent 533c21c3af
commit 18018b18ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
video_files=$(locate -d ~/.config/.mymlocate.db -b -r '.*\.\(mp4\|mkv\|webm\|mov\|m4v\|wmv\|flv\|avi\)$') video_files=$(locate -d ~/.config/.mymlocate.db -b -r '.*\.\(mp4\|mkv\|webm\|mov\|m4v\|wmv\|flv\|avi\)$')
chosen_file=$(echo "$video_files" | sed 's|.*/||; s/\.[^.]*$//' | dmenu -p "Select Video") chosen_file=$(echo "$video_files" | sed 's|.*/||; s/\.[^.]*$//' | dmenu -p "Select Video")
mpv "$(echo "$video_files" | grep "/$chosen_file.")" mpv "$(echo "$video_files" | fgrep "/$chosen_file.")"