aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mocplay
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-11-22 02:14:25 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-11-22 11:13:34 +0530
commit1cca9e4b72b106374f203890b266f18609deefe3 (patch)
tree9f281f4b4de296c54d13dc9c7e214f58835636a7 /plugins/mocplay
parentee2dcb1de7d3e82b330f49ee9fb5dfd4608207ff (diff)
downloadnnn-1cca9e4b72b106374f203890b266f18609deefe3.tar.gz
shellcheck fixes
Diffstat (limited to 'plugins/mocplay')
-rwxr-xr-xplugins/mocplay11
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/mocplay b/plugins/mocplay
index 5f37c37..211a3db 100755
--- a/plugins/mocplay
+++ b/plugins/mocplay
@@ -18,7 +18,8 @@ ret=$cmd
SHUFFLE=0
-mocp_add() {
+mocp_add ()
+{
if [ $SHUFFLE = 1 ]; then
if [ "$resp" = "y" ]; then
arr=$(tr '\0' '\n' < "$selection")
@@ -38,7 +39,7 @@ mocp_add() {
arr2=$(echo "$arr2" | awk 'BEGIN{srand();}{print rand()"\t"$0}' | sort -k1 -n | cut -f2-)
for entry in $arr2
do
- if [ -f "$entry" ] && [ "$(echo "$entry" | grep -v '\.m3u$\|\.pls$')" ]; then
+ if [ -f "$entry" ] && echo "$entry" | grep -qv '\.m3u$\|\.pls$' ; then
mocp -a "$entry"
fi
done
@@ -57,8 +58,8 @@ if [ ! -s "$selection" ] && [ -z "$1" ]; then
fi
if [ -s "$selection" ]; then
- echo -n "Work with selection? Enter 'y' to confirm: "
- read resp
+ printf "Work with selection? Enter 'y' to confirm: "
+ read -r resp
fi
if [ -z "$ret" ]; then
@@ -68,7 +69,7 @@ else
# mocp running, check if it's playing
state=$(mocp -i | grep "State:" | cut -d' ' -f2)
- if [ $state = 'PLAY' ]; then
+ if [ "$state" = 'PLAY' ]; then
# add to playlist and exit
mocp_add "$1"