Yes
March 7th, 2008, 08:02 PM
I'm trying to write a program that will output the current state of mpd.
Here's what I have so far:
#!bin/sh
mpc_stopped=`exec mpc | grep stopped | cut -c 2-3`
mpc_paused=`exec mpc | grep paused | cut -c 2-3`
mpc_playing=`exec mpc | grep playing | cut -c 2-3`
echo $mpc_stopped
echo $mpc_paused
echo $mpc_playing
if [ "$mpc_stopped" == "st"]
then
echo "STOPPED"
elif ["$mpc_paused" == "pa"]
then
echo "PAUSED"
elif ["$mpc_playing" == "pl"]
then
echo "PLAYING"
fi
And here's the errors...
pl
[: 19: missing ]
[: 19: missing ]
mpc.sh: 19: [pl: not found
So I have no idea why it's doing that. Can anyone help?
Here's what I have so far:
#!bin/sh
mpc_stopped=`exec mpc | grep stopped | cut -c 2-3`
mpc_paused=`exec mpc | grep paused | cut -c 2-3`
mpc_playing=`exec mpc | grep playing | cut -c 2-3`
echo $mpc_stopped
echo $mpc_paused
echo $mpc_playing
if [ "$mpc_stopped" == "st"]
then
echo "STOPPED"
elif ["$mpc_paused" == "pa"]
then
echo "PAUSED"
elif ["$mpc_playing" == "pl"]
then
echo "PLAYING"
fi
And here's the errors...
pl
[: 19: missing ]
[: 19: missing ]
mpc.sh: 19: [pl: not found
So I have no idea why it's doing that. Can anyone help?